diff --git a/assets/images/svgs/edit-icon.svg b/assets/images/svgs/edit-icon.svg new file mode 100644 index 00000000..8fdc3cba --- /dev/null +++ b/assets/images/svgs/edit-icon.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..51d064f3 --- /dev/null +++ b/assets/images/svgs/resolve.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart b/lib/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart index 1e006cf8..d0beffa0 100644 --- a/lib/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart +++ b/lib/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart @@ -75,6 +75,7 @@ class AllergyReactionDTOs { int? hospitalID; bool? isActive; String? reactionSelection =""; + bool? isSelected =false; AllergyReactionDTOs( {this.allergyReactionID, this.allergyReactionName, @@ -82,7 +83,8 @@ class AllergyReactionDTOs { this.hospitalGroupID, this.hospitalID, this.isActive, - this.reactionSelection + this.reactionSelection, + this.isSelected, }); AllergyReactionDTOs.fromJson(Map json) { diff --git a/lib/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart b/lib/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart new file mode 100644 index 00000000..2da8fa58 --- /dev/null +++ b/lib/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart @@ -0,0 +1,124 @@ +class PatientAllergiesVidaPlus { + int? allergyID; + String? allergyName; + int? allergyTypeID; + String? allergyTypeName; + int? hospitalGroupID; + int? hospitalID; + bool? isActivePatientsAllergy; + int? patientID; + List? patientsAllergyReactionsDTOs; + int? patientsAllergyRevisionID; + int? pomrID; + String? remark; + + PatientAllergiesVidaPlus( + {this.allergyID, + this.allergyName, + this.allergyTypeID, + this.allergyTypeName, + this.hospitalGroupID, + this.hospitalID, + this.isActivePatientsAllergy, + this.patientID, + this.patientsAllergyReactionsDTOs, + this.patientsAllergyRevisionID, + this.pomrID, + this.remark}); + + PatientAllergiesVidaPlus.fromJson(Map json) { + allergyID = json['allergyID']; + allergyName = json['allergyName']; + allergyTypeID = json['allergyTypeID']; + allergyTypeName = json['allergyTypeName']; + hospitalGroupID = json['hospitalGroupID']; + hospitalID = json['hospitalID']; + isActivePatientsAllergy = json['isActivePatientsAllergy']; + patientID = json['patientID']; + if (json['patientsAllergyReactionsDTOs'] != null) { + patientsAllergyReactionsDTOs = []; + json['patientsAllergyReactionsDTOs'].forEach((v) { + patientsAllergyReactionsDTOs! + .add(new PatientsAllergyReactionsDTOs.fromJson(v)); + }); + } + patientsAllergyRevisionID = json['patientsAllergyRevisionID']; + pomrID = json['pomrID']; + remark = json['remark']; + } + + Map toJson() { + final Map data = new Map(); + data['allergyID'] = this.allergyID; + data['allergyName'] = this.allergyName; + data['allergyTypeID'] = this.allergyTypeID; + data['allergyTypeName'] = this.allergyTypeName; + data['hospitalGroupID'] = this.hospitalGroupID; + data['hospitalID'] = this.hospitalID; + data['isActivePatientsAllergy'] = this.isActivePatientsAllergy; + data['patientID'] = this.patientID; + if (this.patientsAllergyReactionsDTOs != null) { + data['patientsAllergyReactionsDTOs'] = + this.patientsAllergyReactionsDTOs!.map((v) => v.toJson()).toList(); + } + data['patientsAllergyRevisionID'] = this.patientsAllergyRevisionID; + data['pomrID'] = this.pomrID; + data['remark'] = this.remark; + return data; + } +} + +class PatientsAllergyReactionsDTOs { + int? allergyReactionID; + int? allergyReactionMappingID; + String? allergyReactionName; + int? hospitalGroupID; + int? hospitalID; + bool? isActive; + int? patientID; + int? patientsAllergyReactionRevisionID; + int? pomrId; + int? severity; + + PatientsAllergyReactionsDTOs( + {this.allergyReactionID, + this.allergyReactionMappingID, + this.allergyReactionName, + this.hospitalGroupID, + this.hospitalID, + this.isActive, + this.patientID, + this.patientsAllergyReactionRevisionID, + this.pomrId, + this.severity}); + + PatientsAllergyReactionsDTOs.fromJson(Map json) { + allergyReactionID = json['allergyReactionID']; + allergyReactionMappingID = json['allergyReactionMappingID']; + allergyReactionName = json['allergyReactionName']; + hospitalGroupID = json['hospitalGroupID']; + hospitalID = json['hospitalID']; + isActive = json['isActive']; + patientID = json['patientID']; + patientsAllergyReactionRevisionID = + json['patientsAllergyReactionRevisionID']; + pomrId = json['pomrId']; + severity = json['severity']; + } + + Map toJson() { + final Map data = new Map(); + data['allergyReactionID'] = this.allergyReactionID; + data['allergyReactionMappingID'] = this.allergyReactionMappingID; + data['allergyReactionName'] = this.allergyReactionName; + data['hospitalGroupID'] = this.hospitalGroupID; + data['hospitalID'] = this.hospitalID; + data['isActive'] = this.isActive; + data['patientID'] = this.patientID; + data['patientsAllergyReactionRevisionID'] = + this.patientsAllergyReactionRevisionID; + data['pomrId'] = this.pomrId; + data['severity'] = this.severity; + return data; + } +} diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index 95f7e7e9..362a8273 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart'; import 'package:doctor_app_flutter/core/model/SOAP/general_get_req_for_SOAP.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; @@ -34,6 +35,7 @@ class SOAPService extends LookupService { List patientProgressNoteList = []; List patientAssessmentList = []; List searchAllergiesList =[]; + List patientAllergiesVidaPlus =[]; int? episodeID; bool isPrescriptionOrder =false; Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async { @@ -345,10 +347,10 @@ class SOAPService extends LookupService { await baseAppClient.post(PATIENT_ALLERGIES, onSuccess: (dynamic response, int statusCode) { print("Success"); - patientAllergiesList.clear(); + patientAllergiesVidaPlus.clear(); - response['List_Allergies']['entityList'].forEach((v) { - patientAllergiesList.add(GetAllergiesResModel.fromJson(v)); + response['List_PatientAllergies']['resultData'].forEach((v) { + patientAllergiesVidaPlus.add(PatientAllergiesVidaPlus.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 0c0f9ef4..16002dfe 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -36,6 +36,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/pla import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart'; import '../../locator.dart'; +import '../model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart'; import '../model/SOAP/assessment/patch_assessment_req_model.dart'; import 'base_view_model.dart'; @@ -82,7 +83,7 @@ class SOAPViewModel extends BaseViewModel { List get searchAllergiesVidaPlus => _SOAPService.searchAllergiesList; - + List get patientAllergiesVidaPlus => _SOAPService.patientAllergiesVidaPlus; int? get episodeID => _SOAPService.episodeID; diff --git a/lib/screens/patients/patient_search/patient_search_header.dart b/lib/screens/patients/patient_search/patient_search_header.dart index d10a163b..b4276dab 100644 --- a/lib/screens/patients/patient_search/patient_search_header.dart +++ b/lib/screens/patients/patient_search/patient_search_header.dart @@ -9,6 +9,7 @@ class PatientSearchHeader extends StatelessWidget implements PreferredSizeWidget @override Widget build(BuildContext context) { return Container( + height: 120, padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration( color: Colors.white, diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart index fb4201c5..93f3e824 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart @@ -6,8 +6,9 @@ class BottomSheetTitle extends StatelessWidget implements PreferredSizeWidget { BottomSheetTitle({ Key? key, this.title = '', + this.isClose =true }) : super(key: key); - + bool isClose; final String title; double headerHeight = SizeConfig.heightMultiplier! * 15; @@ -41,7 +42,7 @@ class BottomSheetTitle extends StatelessWidget implements PreferredSizeWidget { onTap: () { Navigator.pop(context); }, - child: Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 5, color: Color(0xFF2B353E))) + child: isClose ? Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 5, color: Color(0xFF2B353E)) :SizedBox()) ], ), ], diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart index 0fe34d67..e5ed2a53 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart @@ -10,15 +10,14 @@ import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dar import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../../../../../core/model/SOAP/allergy/get_allergies_list_vida_plus.dart'; import '../../shared_soap_widgets/SOAP_open_items.dart'; import 'add_allergies.dart'; // ignore: must_be_immutable class UpdateAllergiesWidget extends StatefulWidget { - // AllergiesListVidaPlus? selectedAllergy; + List? myAllergiesList; - UpdateAllergiesWidget({Key? key}); + UpdateAllergiesWidget({Key? key, this.myAllergiesList}); @override _UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState(); @@ -30,7 +29,7 @@ class _UpdateAllergiesWidgetState extends State { ProjectViewModel projectViewModel = Provider.of(context); changeAllState() { setState(() { - // print(widget.myAllergiesList); + print(widget.myAllergiesList); }); } @@ -45,97 +44,94 @@ class _UpdateAllergiesWidgetState extends State { SizedBox( height: 20, ), - // Container( - // margin: EdgeInsets.only(left: 15, right: 15, top: 15), - // child: Column( - // children: widget.myAllergiesList!.map((selectedAllergy) { - // return Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // AppText( - // projectViewModel.isArabic ? selectedAllergy.selectedAllergy!.nameAr! : selectedAllergy.selectedAllergy!.nameEn!.toUpperCase(), - // textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough, - // bold: true, - // color: Color(0xFF2B353E), - // fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, - // fontWeight: FontWeight.w700, - // letterSpacing: -0.48, - // // fontHeight:0.18 , - // ), - // AppText( - // projectViewModel.isArabic ? selectedAllergy.selectedAllergySeverity!.nameAr! : selectedAllergy.selectedAllergySeverity!.nameEn ?? ""!.toUpperCase(), - // textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough, - // color: Color(0xFFCC9B14), - // fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, - // fontWeight: FontWeight.w700, - // letterSpacing: -0.48, - // ), - // ], - // ), - // width: MediaQuery.of(context).size.width * 0.5, - // ), - // if (selectedAllergy.isChecked) - // RemoveButton( - // onTap: () => removeAllergy(selectedAllergy), - // ) - // ], - // ), - // Padding( - // padding: const EdgeInsets.symmetric(vertical: 8), - // child: Row( - // children: [ - // RemarkText( - // remark: selectedAllergy.remark ?? "", - // ), - // ], - // ), - // ), - // DividerWithSpacesAround() - // ], - // ), - // SizedBox( - // height: 10, - // ), - // ], - // ); - // }).toList()), - ], + Container( + margin: EdgeInsets.only(left: 15, right: 15, top: 15), + child: Column( + children: widget.myAllergiesList!.map((selectedAllergy) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + projectViewModel.isArabic ? selectedAllergy.selectedAllergy!.nameAr! : selectedAllergy.selectedAllergy!.nameEn!.toUpperCase(), + textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough, + bold: true, + color: Color(0xFF2B353E), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + fontWeight: FontWeight.w700, + letterSpacing: -0.48, + // fontHeight:0.18 , + ), + AppText( + projectViewModel.isArabic ? selectedAllergy.selectedAllergySeverity!.nameAr! : selectedAllergy.selectedAllergySeverity!.nameEn ?? ""!.toUpperCase(), + textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough, + color: Color(0xFFCC9B14), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w700, + letterSpacing: -0.48, + ), + ], + ), + width: MediaQuery.of(context).size.width * 0.5, + ), + if (selectedAllergy.isChecked) + RemoveButton( + onTap: () => removeAllergy(selectedAllergy), + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Row( + children: [ + RemarkText( + remark: selectedAllergy.remark ?? "", + ), + ], + ), + ), + DividerWithSpacesAround() + ], + ), + SizedBox( + height: 10, + ), + ], + ); + }).toList()), + ) + ], ); } removeAllergy(MySelectedAllergy mySelectedAllergy) { - // List allergy = - // // ignore: missing_return - // widget.myAllergiesList! - // .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id) - // .toList(); - // - // if (allergy.length > 0) { - // if (allergy.first.isLocal) { - // setState(() { - // widget.myAllergiesList!.remove(allergy.first); - // }); - // } - // setState(() { - // allergy[0].isChecked = false; - // }); - // } - } - - openReaction(){ + List allergy = + // ignore: missing_return + widget.myAllergiesList! + .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id) + .toList(); + if (allergy.length > 0) { + if (allergy.first.isLocal) { + setState(() { + widget.myAllergiesList!.remove(allergy.first); + }); + } + setState(() { + allergy[0].isChecked = false; + }); + } } openAllergiesList(BuildContext context, Function changeParentState, removeAllergy) { @@ -146,53 +142,51 @@ class _UpdateAllergiesWidgetState extends State { context: context, builder: (context) { return AddAllergies( - addAllergiesFun: (AllergiesListVidaPlus selectedAllergy) { + myAllergiesList: widget.myAllergiesList, + addAllergiesFun: (List mySelectedAllergy) { + bool isAllDataFilled = true; + mySelectedAllergy.forEach((element) { + if (element.selectedAllergySeverity == null) { + element.hasValidationError = true; + isAllDataFilled = false; + } + }); + if (isAllDataFilled) { + mySelectedAllergy.forEach((element) { + if ( + widget.myAllergiesList!.singleWhere( + (it) => it.selectedAllergy!.id == element.selectedAllergy!.id, + orElse: () => MySelectedAllergy(), + ).selectedAllergySeverity + == + null) { + widget.myAllergiesList!.add(element); + } + }); - openReaction(); + /// remove items. + List removedList = []; + widget.myAllergiesList!.forEach((element) { + if ( + mySelectedAllergy.singleWhere( + (it) => it.selectedAllergy!.id == element.selectedAllergy!.id, + orElse: () => MySelectedAllergy(), + ) + .selectedAllergySeverity == + null) { + removedList.add(element); + } + }); - // bool isAllDataFilled = true; - // mySelectedAllergy.forEach((element) { - // if (element.selectedAllergySeverity == null) { - // element.hasValidationError = true; - // isAllDataFilled = false; - // } - // }); - // if (isAllDataFilled) { - // mySelectedAllergy.forEach((element) { - // if ( - // widget.myAllergiesList!.singleWhere( - // (it) => it.selectedAllergy!.id == element.selectedAllergy!.id, - // orElse: () => MySelectedAllergy(), - // ).selectedAllergySeverity - // == - // null) { - // widget.myAllergiesList!.add(element); - // } - // }); - // - // /// remove items. - // List removedList = []; - // widget.myAllergiesList!.forEach((element) { - // if ( - // mySelectedAllergy.singleWhere( - // (it) => it.selectedAllergy!.id == element.selectedAllergy!.id, - // orElse: () => MySelectedAllergy(), - // ) - // .selectedAllergySeverity == - // null) { - // removedList.add(element); - // } - // }); - // - // removedList.forEach((element) { - // removeAllergy(element); - // }); - // changeParentState(); + removedList.forEach((element) { + removeAllergy(element); + }); + changeParentState(); - // Navigator.of(context).pop(); - // } else { - // Utils.showErrorToast(TranslationBase.of(context).requiredMsg); - // } + Navigator.of(context).pop(); + } else { + Utils.showErrorToast(TranslationBase.of(context).requiredMsg); + } }); }); } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/add_allergies.dart index a0eda071..67f50b15 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/add_allergies.dart @@ -8,8 +8,10 @@ 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/bottom_sheet/custom_bottom_sheet_container.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 '../../../../patient_search/patient_search_header.dart'; import '../../../soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'master_key_checkbox_search_allergies_widget.dart'; @@ -17,7 +19,8 @@ class AddAllergies extends StatefulWidget { final Function? addAllergiesFun; final AllergiesListVidaPlus? myAllergiesList; - const AddAllergies({Key? key, this.addAllergiesFun, this.myAllergiesList}) : super(key: key); + const AddAllergies({Key? key, this.addAllergiesFun, this.myAllergiesList}) + : super(key: key); @override _AddAllergiesState createState() => _AddAllergiesState(); @@ -26,8 +29,8 @@ class AddAllergies extends StatefulWidget { class _AddAllergiesState extends State { // List allergiesList = []; // List allergySeverityList = []; - // - // myAllergiesListLocal = []; + // + // myAllergiesListLocal = []; @override initState() { @@ -40,106 +43,71 @@ class _AddAllergiesState extends State { @override Widget build(BuildContext context) { - return AppScaffold( - // baseViewModel: model, - isShowAppBar: true, - appBar: BottomSheetTitle( - title: TranslationBase.of(context).addAllergies, - ), - body: Center( - child: Container( - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 10, - ), - SizedBox( - height: 16, - ), - Expanded( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Center( - child: BaseView( - onModelReady: (model) async {}, - builder: (_, model, w) { - return MasterKeyCheckboxSearchAllergiesWidget( - model: model, + return BaseView( + builder: (_, model, w) => AppScaffold( + + isShowAppBar: true, - addAllergy: (AllergiesListVidaPlus mySelectedAllergy) { - widget.addAllergiesFun!(mySelectedAllergy); - }, + appBar: PatientSearchHeader( - ); - }), - ), - ), + title: TranslationBase.of(context).addAllergies), + body: MasterKeyCheckboxSearchAllergiesWidget( + model: model, + // addAllergy: (AllergiesListVidaPlus mySelectedAllergy) { + // widget.addAllergiesFun!(mySelectedAllergy); + // }, ), - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.11, - ), - ]), - ), - ), - bottomSheet: - // model.state != ViewState.Idle - // ? - // Container( - // height: 0, - // ) - // : - CustomBottomSheetContainer( - buttonColor: Color(0xffEAEAEA), - fontColor: Colors.black, - label: TranslationBase.of(context).cancel, - onTap: () { - Navigator.of(context).pop(); - }, - ), - ); + bottomSheet: CustomBottomSheetContainer( + buttonColor: Color(0xffEAEAEA), + fontColor: Colors.black, + label: TranslationBase.of(context).cancel, + onTap: () { + Navigator.of(context).pop(); + }, + ), + )); } - // - // isServiceSelected(MasterKeyModel masterKey) { - // Iterable allergy = - // myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked); - // if (allergy.length > 0) { - // return true; - // } - // return false; - // } - // - // removeAllergyFromLocalList(MasterKeyModel masterKey) { - // myAllergiesListLocal.removeWhere((element) => element.selectedAllergy!.id == masterKey.id); - // } - // - // MySelectedAllergy getSelectedAllergy(MasterKeyModel masterKey) { - // Iterable allergy = - // myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked); - // if (allergy.length > 0) { - // return allergy.first; - // } - // return MySelectedAllergy(); - // } - // - // addAllergyLocally(AllergiesListVidaPlus mySelectedAllergy) { - // if (mySelectedAllergy.selectedAllergy == null) { - // Utils.showErrorToast(TranslationBase.of(context).requiredMsg); - // } else { - // setState(() { - // List allergy = - // // ignore: missing_return - // myAllergiesListLocal.where((element) => mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id).toList(); - // - // if (allergy.isEmpty) { - // myAllergiesListLocal.add(mySelectedAllergy); - // } else { - // allergy.first.selectedAllergy = mySelectedAllergy.selectedAllergy; - // allergy.first.selectedAllergySeverity = mySelectedAllergy.selectedAllergySeverity; - // allergy.first.remark = mySelectedAllergy.remark; - // allergy.first.isChecked = mySelectedAllergy.isChecked; - // } - // }); - // } - // } +// +// isServiceSelected(MasterKeyModel masterKey) { +// Iterable allergy = +// myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked); +// if (allergy.length > 0) { +// return true; +// } +// return false; +// } +// +// removeAllergyFromLocalList(MasterKeyModel masterKey) { +// myAllergiesListLocal.removeWhere((element) => element.selectedAllergy!.id == masterKey.id); +// } +// +// MySelectedAllergy getSelectedAllergy(MasterKeyModel masterKey) { +// Iterable allergy = +// myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked); +// if (allergy.length > 0) { +// return allergy.first; +// } +// return MySelectedAllergy(); +// } +// +// addAllergyLocally(AllergiesListVidaPlus mySelectedAllergy) { +// if (mySelectedAllergy.selectedAllergy == null) { +// Utils.showErrorToast(TranslationBase.of(context).requiredMsg); +// } else { +// setState(() { +// List allergy = +// // ignore: missing_return +// myAllergiesListLocal.where((element) => mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id).toList(); +// +// if (allergy.isEmpty) { +// myAllergiesListLocal.add(mySelectedAllergy); +// } else { +// allergy.first.selectedAllergy = mySelectedAllergy.selectedAllergy; +// allergy.first.selectedAllergySeverity = mySelectedAllergy.selectedAllergySeverity; +// allergy.first.remark = mySelectedAllergy.remark; +// allergy.first.isChecked = mySelectedAllergy.isChecked; +// } +// }); +// } +// } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart index de7aa4a4..da1177aa 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/master_key_checkbox_search_allergies_widget.dart @@ -1,43 +1,32 @@ -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/allergy/get_allergies_list_vida_plus.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_allergy.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.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/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_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 'allergies_item.dart'; +import '../../../../../../widgets/transitions/fade_page.dart'; + class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { final SOAPViewModel model; - // final Function() addSelectedAllergy; - // final Function(MasterKeyModel) removeAllergy; - final Function(AllergiesListVidaPlus mySelectedAllergy) addAllergy; - // final bool Function(MasterKeyModel) isServiceSelected; - // final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy; - - // final List masterList; final String? buttonName; final String? hintSearchText; MasterKeyCheckboxSearchAllergiesWidget( {Key? key, required this.model, - // required this.addSelectedAllergy, - // required this.removeAllergy, - // required this.masterList, - required this.addAllergy, - // required this.isServiceSelected, + + // required this.addAllergy, + this.buttonName, this.hintSearchText, - // required this.getServiceSelectedAllergy + }) : super(key: key); @@ -58,15 +47,17 @@ bool loading =false; @override Widget build(BuildContext context) { - return Container( - child: Column( + return Column( children: [ + Expanded( child: Container( + + margin: EdgeInsets.all(20), height: Utils.getTextFieldHeight(), child: Center( child: Container( - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12)), child: Column( children: [ AppTextFieldCustom( @@ -80,17 +71,8 @@ bool loading =false; }, onFieldSubmitted: () { - // widget.model.getMasterLookup( - // MasterKeysService.Allergies, - // searchKey: filteredSearchController.text); - // widget.model.getMasterLookup( - // MasterKeysService.AllergySeverity, - // searchKey: ""); }, - // onFieldSubmitted: (value) { - // widget.model.getMasterLookup(MasterKeysService.Allergies!, searchKey: filteredSearchController.text!); - // widget.model.getMasterLookup(MasterKeysService.AllergySeverity, searchKey: ""); - // }, + suffixIcon: IconButton( icon: Icon( Icons.search, @@ -110,9 +92,8 @@ bool loading =false; height: 10, ), Expanded( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Container( + child: RoundedContainer( + width:MediaQuery.of(context).size.width , height: MediaQuery.of(context).size.height * 0.60, child: widget.model.state == ViewState.Idle ? ListView.builder( @@ -120,27 +101,17 @@ bool loading =false; itemBuilder: (context, index) { loading =false; return ListTile(title: AppText(widget.model.searchAllergiesVidaPlus[index].allergyName!), trailing: TextButton.icon(icon: SvgPicture.asset("assets/images/svgs/add-square.svg", color: Color(0xffD02127),), style: ButtonStyle(iconColor: WidgetStateProperty.all(Color(0xffD02127)), ), onPressed: (){ - widget.addAllergy(widget.model.searchAllergiesVidaPlus[index]); + openReaction(widget.model, widget.model.searchAllergiesVidaPlus[index]); }, label: AppText(TranslationBase.of(context).add, fontSize:12, color:Color(0xffD02127) ,), ), ); - - - // return AddAllergiesItem( - // item: widget.model.allergiesList[index], - // model: widget.model, - // removeAllergy: widget.removeAllergy, - // addAllergy: widget.addAllergy, - // isServiceSelected: widget.isServiceSelected, - // getServiceSelectedAllergy: widget.getServiceSelectedAllergy, - // ); }, ) : loading ? Center(child: CircularProgressIndicator()) :SizedBox() - ), + ), ), ], @@ -149,34 +120,24 @@ bool loading =false; ), ), ), - SizedBox( - height: 10, - ), + ], - ), + ); } - // - // void filterSearchResults(String query) { - // List dummySearchList = []; - // dummySearchList.addAll(widget.masterList); - // if (query.isNotEmpty) { - // List dummyListData = []; - // dummySearchList.forEach((items) { - // if (items.nameAr!.toLowerCase().contains(query.toLowerCase()) || items.nameEn!.toLowerCase().contains(query.toLowerCase())) { - // dummyListData.add(items); - // } - // }); - // setState(() { - // items.clear(); - // items.addAll(dummyListData); - // }); - // return; - // } else { - // setState(() { - // items.clear(); - // items.addAll(widget.masterList); - // }); - // } - // } +openReaction(model, AllergiesListVidaPlus mySelectedAllergy){ + Navigator.push( + context, + FadePage( + page:ReactionsSelectionAllergiesWidget( + model:model, + mySelectedAllergy: mySelectedAllergy, + addReactionFun: (AllergiesListVidaPlus mySelectedAllergy) { + Navigator.of(context).pop(); + + }) + )); + + } + } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart index 2b8c5887..11e0cbde 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart @@ -8,7 +8,11 @@ import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart' import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import '../../../../../../config/config.dart'; +import '../../../../../../widgets/bottom_sheet/custom_bottom_sheet_container.dart'; import '../../../../../../widgets/shared/app_scaffold_widget.dart'; +import '../../../../../../widgets/shared/buttons/app_buttons_widget.dart'; +import '../../../../patient_search/patient_search_header.dart'; import '../../../soap_update/shared_soap_widgets/bottom_sheet_title.dart'; class ReactionsSelectionAllergiesWidget extends StatefulWidget { @@ -46,124 +50,207 @@ class _ReactionsSelectionAllergiesWidgetState @override Widget build(BuildContext context) { return AppScaffold( - // baseViewModel: model, - isShowAppBar: true, - appBar: BottomSheetTitle( - title: "Select Reactions" // TranslationBase.of(context).reac, - ), - backgroundColor: Color(0xffbacF7F7F7), - body: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: RoundedContainer( - - margin: EdgeInsets.all(15), - child: ListView.builder( - - itemCount: - widget.mySelectedAllergy.allergyReactionDTOs!.length, - itemBuilder: (context, index) { - loading = false; - return Column(children: [ ExpansionTile( - dense: false, - enableFeedback: false, - showTrailingIcon: false, - leading: Checkbox(value: false, onChanged: (bool) {}), - title: AppText(widget.mySelectedAllergy - .allergyReactionDTOs![index].allergyReactionName!), - children: [ - Row( + // isShowAppBar: true, + appBar: PatientSearchHeader( + title: "Select Reaction" + ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: RoundedContainer( + margin: EdgeInsets.all(15), + child: ListView.builder( + itemCount: + widget.mySelectedAllergy.allergyReactionDTOs!.length, + itemBuilder: (context, index) { + loading = false; + return Column(children: [ + ExpansionTile( + key: Key(index.toString()), + dense: false, + enableFeedback: false, + showTrailingIcon: false, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: ListTile( - title: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Radio( + initiallyExpanded: widget + .mySelectedAllergy + .allergyReactionDTOs![index].isSelected!, + leading: + Checkbox( activeColor: Color(0xffD02127), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // Reduces padding around checkbox - visualDensity: VisualDensity.compact, - value: "Mild", - groupValue: widget - .mySelectedAllergy - .allergyReactionDTOs![index].reactionSelection, - onChanged: (value) { - widget - .mySelectedAllergy - .allergyReactionDTOs![index].reactionSelection =value; - setState(() { - - }); - }, - ), - AppText('Mild', fontSize: 10,), - ], - ))), - Expanded( - child: ListTile( - title: Row( + value: widget + .mySelectedAllergy + .allergyReactionDTOs![index].isSelected!, onChanged: (value) { - children: [ - Radio( - activeColor: Color(0xffD02127), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // Reduces padding around checkbox - visualDensity: VisualDensity.compact, - value: "moderate", - groupValue: widget - .mySelectedAllergy + widget + .mySelectedAllergy + .allergyReactionDTOs![index].isSelected = value; + setState(() { - .allergyReactionDTOs![index].reactionSelection, - onChanged: (value) { - widget - .mySelectedAllergy - .allergyReactionDTOs![index].reactionSelection =value; - setState(() { + }); - }); - }, - ), - AppText('Moderate', fontSize: 10,), - ], - ))), - Expanded( - child: ListTile( - title: Row( + }), + title: AppText(widget + .mySelectedAllergy + .allergyReactionDTOs![index] + .allergyReactionName!), + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: ListTile( + title: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Radio( + activeColor: Color(0xffD02127), + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + // Reduces padding around checkbox + visualDensity: VisualDensity.compact, + value: "Mild", + groupValue: widget + .mySelectedAllergy + .allergyReactionDTOs![index] + .reactionSelection, + onChanged: (value) { + widget + .mySelectedAllergy + .allergyReactionDTOs![index] + .reactionSelection = value; + setState(() {}); + }, + ), + AppText( + 'Mild', + fontSize: 10, + ), + ], + ))), + Expanded( + child: ListTile( + title: Row( + children: [ + Radio( + activeColor: Color(0xffD02127), + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + // Reduces padding around checkbox + visualDensity: VisualDensity.compact, + value: "moderate", + groupValue: widget + .mySelectedAllergy + .allergyReactionDTOs![index] + .reactionSelection, + onChanged: (value) { + widget + .mySelectedAllergy + .allergyReactionDTOs![index] + .reactionSelection = value; + setState(() {}); + }, + ), + AppText( + 'Moderate', + fontSize: 10, + ), + ], + ))), + Expanded( + child: ListTile( + title: Row( + children: [ + Radio( + activeColor: Color(0xffD02127), + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + // Reduces padding around checkbox + visualDensity: VisualDensity.compact, + value: "severe", + groupValue: widget + .mySelectedAllergy + .allergyReactionDTOs![index] + .reactionSelection, + onChanged: (value) { + widget + .mySelectedAllergy + .allergyReactionDTOs![index] + .reactionSelection = value; + setState(() {}); + }, + ), + AppText( + 'Severe', + fontSize: 10, + ), + ], + ))) + ], + ) + ], + ), + Divider(), + ]); + }, + ))) + ], + ), + bottomSheet: Container( + height: 90, + color: Colors.white, + margin: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + vPadding: 8, + hPadding: 8, + color: Color(0xffEAEAEA), + fontColor: Colors.black, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).save, + vPadding: 8, + hPadding: 8, + color: AppGlobal.appGreenColor, + fontColor: Colors.white, + onPressed: () { + widget.addReactionFun(widget + .mySelectedAllergy + ); + }, + ), + ), + ), + ], + )) - children: [ - Radio( - activeColor: Color(0xffD02127), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // Reduces padding around checkbox - visualDensity: VisualDensity.compact, - value: "severe", - groupValue: widget - .mySelectedAllergy - .allergyReactionDTOs![index].reactionSelection, - onChanged: (value) { - widget - .mySelectedAllergy - .allergyReactionDTOs![index].reactionSelection =value; - setState(() { + // CustomBottomSheetContainer( + // buttonColor: Color(0xff359846), + // fontColor: Colors.white, + // label: TranslationBase.of(context).next, + // onTap: () { + // widget.addReactionFun(widget + // .mySelectedAllergy + // ); + // }, + // ) - }); - }, - ), - AppText('Severe', fontSize: 10,), - ], - ))) - ], - ) - ], - ), - Divider(), - ]); - }, - ))) - ], - ), - ); + ); } } 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 3939071a..08e8dc72 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 @@ -1,32 +1,37 @@ -import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart'; + +import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.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'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; +import '../../../../../../widgets/transitions/fade_page.dart'; import '../chief_complaint/widgets/add_chief_complaint.dart'; import 'add_allergies.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -// ignore: must_be_immutable + class UpdateAllergiesWidgetVidaPlus extends StatefulWidget { - List? myAllergiesList; + List? myAllergiesList; UpdateAllergiesWidgetVidaPlus({Key? key, this.myAllergiesList}); @override _UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState(); } -bool noKnownAllergies = false; + +bool noKnownAllergies = false; +enum Severity {mild,moderate,severe } + class _UpdateAllergiesWidgetState extends State { SOAPViewModel? model; + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); changeAllState() { setState(() { - print(widget.myAllergiesList); + print(widget.myAllergiesList); }); } @@ -37,160 +42,135 @@ class _UpdateAllergiesWidgetState extends State { ), AddSoapItem( title: "${TranslationBase.of(context).addAllergies}", - onAddSoapItemClicked: (){ - openAllergiesList(context, changeAllState); + onAddSoapItemClicked: () { + Navigator.push( + context, + FadePage( + page: AddAllergies(), + ), + ); }, - ), SizedBox( height: 20, ), + widget.myAllergiesList!.isEmpty + ? Row( + mainAxisSize: MainAxisSize.max, + children: [ + Checkbox( + value: noKnownAllergies, + checkColor: Colors.white, + activeColor: Colors.red, + onChanged: (value) { + noKnownAllergies = value!; + setState(() {}); + }, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + // Reduces padding around checkbox + visualDensity: + VisualDensity.compact, // Minimizes size further + ), + AppText(TranslationBase.of(context).noKnownAllergies) + ], + ) + : Divider( + thickness: 1, + color: Color(0xffEFEFEF), + ), + ListView( + padding: EdgeInsets.all(10), + shrinkWrap: true, + children: widget.myAllergiesList!.map((selectedAllergy) { + return Column( - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Checkbox( - value: noKnownAllergies, - checkColor: Colors.white, - activeColor: Colors.red, - onChanged: (value) { - noKnownAllergies = value!; - setState(() {}); - }, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // Reduces padding around checkbox - visualDensity: VisualDensity.compact, // Minimizes size further - ), - AppText(TranslationBase.of(context).noKnownAllergies) - ], - ), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + selectedAllergy.allergyName!, + fontSize: 12, + fontWeight: FontWeight.w800, + letterSpacing: -0.48, + ), + selectedAllergy.patientsAllergyReactionsDTOs!.isNotEmpty ? ListView( + shrinkWrap: true, + children: selectedAllergy.patientsAllergyReactionsDTOs!.map((PatientsAllergyReactionsDTOs reaction) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ - // Container( - // margin: EdgeInsets.only(left: 15, right: 15, top: 15), - // child: Column( - // children: widget.myAllergiesList!.map((selectedAllergy) { - // return Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // AppText( - // projectViewModel.isArabic ? selectedAllergy.selectedAllergy!.nameAr! : selectedAllergy.selectedAllergy!.nameEn!.toUpperCase(), - // textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough, - // bold: true, - // color: Color(0xFF2B353E), - // fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, - // fontWeight: FontWeight.w700, - // letterSpacing: -0.48, - // // fontHeight:0.18 , - // ), - // AppText( - // projectViewModel.isArabic ? selectedAllergy.selectedAllergySeverity!.nameAr! : selectedAllergy.selectedAllergySeverity!.nameEn ?? ""!.toUpperCase(), - // textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough, - // color: Color(0xFFCC9B14), - // fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, - // fontWeight: FontWeight.w700, - // letterSpacing: -0.48, - // ), - // ], - // ), - // width: MediaQuery.of(context).size.width * 0.5, - // ), - // if (selectedAllergy.isChecked) - // RemoveButton( - // onTap: () => removeAllergy(selectedAllergy), - // ) - // ], - // ), - // Padding( - // padding: const EdgeInsets.symmetric(vertical: 8), - // child: Row( - // children: [ - // RemarkText( - // remark: selectedAllergy.remark ?? "", - // ), - // ], - // ), - // ), - // DividerWithSpacesAround() - // ], - // ), - // SizedBox( - // height: 10, - // ), - // ], - // ); - // }).toList()), - // ) - ], - ); - } - // - // removeAllergy(MySelectedAllergy mySelectedAllergy) { - // List allergy = - // // ignore: missing_return - // widget.myAllergiesList! - // .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id) - // .toList(); - // - // if (allergy.length > 0) { - // if (allergy.first.isLocal) { - // setState(() { - // widget.myAllergiesList!.remove(allergy.first); - // }); - // } - // setState(() { - // allergy[0].isChecked = false; - // }); - // } - // } - openAllergiesList(BuildContext context, Function changeParentState) { - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - isDismissible: false, - context: context, - builder: (context) { - return AddAllergies( - addAllergiesFun: (AllergiesListVidaPlus mySelectedAllergy) { - Navigator.of(context).pop(); - openReactionScreen(mySelectedAllergy); - print(mySelectedAllergy); + AppText(reaction.allergyReactionName!), + AppText( + Severity.values[reaction.severity! -1].name, + color: Color(0xFFCC9B14), + fontSize: 10, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ) + ],)).toList()) : AppText("----", color: Color(0xFFCC9B14)), - // } else { - // Utils.showErrorToast(TranslationBase.of(context).requiredMsg); - // } - }); - }); + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + SizedBox( + height: 10, + ), + TextButton.icon( + onPressed: () {}, + icon: SvgPicture.asset( + "assets/images/svgs/edit-icon.svg", + height: 16, + ), + label: AppText( + "Edit", + fontSize: 12, + ), + ), + TextButton.icon( + onPressed: () {}, + icon: SvgPicture.asset( + "assets/images/svgs/resolve.svg", + height: 18, + ), + label: AppText("Resolve", + fontSize: 12, color: Color(0xff359846))) + ], + ) + ], + ); + }).toList()), + ], + ); } -openReactionScreen(AllergiesListVidaPlus mySelectedAllergy){ - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - isDismissible: false, - context: context, - builder: (context) { - return ReactionsSelectionAllergiesWidget( - model:model, - mySelectedAllergy: mySelectedAllergy, - addReactionFun: (AllergiesListVidaPlus mySelectedAllergy) { +// +// removeAllergy(MySelectedAllergy mySelectedAllergy) { +// List allergy = +// // ignore: missing_return +// widget.myAllergiesList! +// .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id) +// .toList(); +// +// if (allergy.length > 0) { +// if (allergy.first.isLocal) { +// setState(() { +// widget.myAllergiesList!.remove(allergy.first); +// }); +// } +// setState(() { +// allergy[0].isChecked = false; +// }); +// } +// } - Navigator.of(context).pop(); - // } else { - // Utils.showErrorToast(TranslationBase.of(context).requiredMsg); - // } - }); - }); -} +// openAllergiesList(BuildContext context, Function changeParentState) { +// showModalBottomSheet( +// backgroundColor: Colors.white, +// isScrollControlled: true, +// isDismissible: false, +// context: context, +// builder: (context) { +// return AddAllergies(); +// }); +// } } diff --git a/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page_vida_plus.dart b/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page_vida_plus.dart index 1f208e5c..396c08ea 100644 --- a/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page_vida_plus.dart +++ b/lib/screens/patients/profile/soap_update_vida_plus/subjective/update_subjective_page_vida_plus.dart @@ -17,24 +17,28 @@ import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import '../../../../../core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart'; import 'allergies/update_allergies_widget.dart'; import 'chief_complaint/chief_complaints.dart'; - class UpdateSubjectivePageVidaPlus extends StatefulWidget { final Function changePageViewIndex; final Function changeLoadingState; final PatiantInformtion patientInfo; final int currentIndex; - UpdateSubjectivePageVidaPlus({Key? key, required this.changePageViewIndex, required this.patientInfo, required this.changeLoadingState, required this.currentIndex}); + UpdateSubjectivePageVidaPlus( + {Key? key, required this.changePageViewIndex, required this.patientInfo, required this.changeLoadingState, required this.currentIndex}); @override - _UpdateSubjectivePageVidaPlusState createState() => _UpdateSubjectivePageVidaPlusState(); + _UpdateSubjectivePageVidaPlusState createState() => + _UpdateSubjectivePageVidaPlusState(); } -class _UpdateSubjectivePageVidaPlusState extends State implements SubjectiveCallBack { +class _UpdateSubjectivePageVidaPlusState + extends State + implements SubjectiveCallBack { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; @@ -43,50 +47,70 @@ class _UpdateSubjectivePageVidaPlusState extends State(); - List myAllergiesList = []; + List myAllergiesList = []; List myHistoryList = []; getHistory(SOAPViewModel model) async { widget.changeLoadingState(true); if (model.patientHistoryList.isNotEmpty) { model.patientHistoryList.forEach((element) { - if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistoryFamily.getMasterKeyService()) { MasterKeyModel? history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryFamily, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + MySelectedHistory mySelectedHistory = SoapUtils + .generateMySelectedHistory(history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistoryMedical.getMasterKeyService()) { MasterKeyModel? history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryMedical, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + MySelectedHistory mySelectedHistory = SoapUtils + .generateMySelectedHistory(history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistorySports.getMasterKeyService()) { MasterKeyModel? history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySports, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + MySelectedHistory mySelectedHistory = SoapUtils + .generateMySelectedHistory(history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) { + if (element.historyType == + MasterKeysService.HistorySurgical.getMasterKeyService()) { MasterKeyModel? history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySurgical, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); + MySelectedHistory mySelectedHistory = SoapUtils + .generateMySelectedHistory(history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -95,25 +119,27 @@ class _UpdateSubjectivePageVidaPlusState extends State 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).chiefComplaints, - onTap: () { - setState(() { - isChiefExpand = !isChiefExpand; - }); - }, - child: UpdateChiefComplaints( - complaints: [], - ), - isExpanded: isChiefExpand, - ), - SizedBox( - height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2), - ), - if (widget.patientInfo.admissionNo == null) - ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).historyOfIllness, - isRequired: false, - onTap: () { - setState(() { - isHistoryExpand = !isHistoryExpand; - }); - }, - child: Column( - children: [UpdatePresentIllness()], + 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, ), - isExpanded: isHistoryExpand, - ), - SizedBox( - height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2), - ), - if (widget.patientInfo.admissionNo == null) - ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).allergiesSoap, - isRequired: false, - onTap: () { - setState(() { - isAllergiesExpand = !isAllergiesExpand; - }); - }, - child: Column( - children: [ - UpdateAllergiesWidgetVidaPlus( - myAllergiesList: myAllergiesList, + ExpandableSOAPWidget( + headerTitle: TranslationBase + .of(context) + .chiefComplaints, + onTap: () { + setState(() { + isChiefExpand = !isChiefExpand; + }); + }, + child: UpdateChiefComplaints( + complaints: [], + ), + isExpanded: isChiefExpand, + ), + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 4 : 2), + ), + if (widget.patientInfo.admissionNo == null) + ExpandableSOAPWidget( + headerTitle: TranslationBase + .of(context) + .historyOfIllness, + isRequired: false, + onTap: () { + setState(() { + isHistoryExpand = !isHistoryExpand; + }); + }, + child: Column( + children: [UpdatePresentIllness()], ), - SizedBox( - height: 30, + isExpanded: isHistoryExpand, + ), + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 4 : 2), + ), + if (widget.patientInfo.admissionNo == null) + ExpandableSOAPWidget( + headerTitle: TranslationBase + .of(context) + .allergiesSoap, + isRequired: false, + onTap: () { + setState(() { + isAllergiesExpand = !isAllergiesExpand; + }); + }, + child: Column( + children: [ + UpdateAllergiesWidgetVidaPlus( + myAllergiesList: myAllergiesList, + ), + SizedBox( + height: 30, + ), + ], ), - ], + isExpanded: isAllergiesExpand, + ), + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort ? 20 : 10), ), - isExpanded: isAllergiesExpand, - ), - SizedBox( - height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : 10), + ], ), - ], + ), ), ), ), - ), - ), ); } - addSubjectiveInfo({required SOAPViewModel model, required List myAllergiesList, required List myHistoryList}) async { - if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); + addSubjectiveInfo({required SOAPViewModel model, required List< + MySelectedAllergy> myAllergiesList, required List< + MySelectedHistory> myHistoryList}) async { + if (FocusScope + .of(context) + .hasFocus) FocusScope.of(context).unfocus(); widget.changeLoadingState(true); formKey.currentState!.save(); formKey.currentState!.validate(); @@ -234,7 +279,8 @@ class _UpdateSubjectivePageVidaPlusState extends State i.isChecked).toList(), myHistoryList: myHistoryList); + // addSubjectiveInfo(model: model, + // // myAllergiesList: myAllergiesList.where((i) => i.isChecked).toList(), + // myHistoryList: myHistoryList); return () {}; } }