diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart index ddb7b9d6..86016be9 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -35,10 +36,12 @@ class UpdateAssessmentPage extends StatefulWidget { final PatiantInformtion patientInfo; final Function changeLoadingState; - UpdateAssessmentPage({Key key, - this.changePageViewIndex, - this.mySelectedAssessmentList, - this.patientInfo, this.changeLoadingState}); + UpdateAssessmentPage( + {Key key, + this.changePageViewIndex, + this.mySelectedAssessmentList, + this.patientInfo, + this.changeLoadingState}); @override _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); @@ -51,7 +54,7 @@ class _UpdateAssessmentPageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) async{ + onModelReady: (model) async { widget.mySelectedAssessmentList.clear(); GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -60,7 +63,7 @@ class _UpdateAssessmentPageState extends State { doctorID: '', appointmentNo: widget.patientInfo.appointmentNo); await model.getPatientAssessment(getAssessmentReqModel); - if(model.patientAssessmentList.isNotEmpty){ + if (model.patientAssessmentList.isNotEmpty) { if (model.listOfDiagnosisCondition.length == 0) { await model.getMasterLookup(MasterKeysService.DiagnosisCondition); } @@ -83,70 +86,92 @@ class _UpdateAssessmentPageState extends State { masterKeys: MasterKeysService.DiagnosisCondition, id: element.conditionID, ); - if(diagnosisCondition !=null &&diagnosisType !=null && diagnosisCondition!=null) { - MySelectedAssessment temMySelectedAssessment = MySelectedAssessment( - appointmentId: element.appointmentNo, - remark: element.remarks, - selectedDiagnosisType: diagnosisType, - selectedDiagnosisCondition: diagnosisCondition, - selectedICD: selectedICD, - doctorID: element.doctorID, - doctorName: element.doctorName, - createdBy: element.createdBy, - createdOn: element.createdOn, - icdCode10ID: element.icdCode10ID - ); + if (diagnosisCondition != null && + diagnosisType != null && + diagnosisCondition != null) { + MySelectedAssessment temMySelectedAssessment = + MySelectedAssessment( + appointmentId: element.appointmentNo, + remark: element.remarks, + selectedDiagnosisType: diagnosisType, + selectedDiagnosisCondition: diagnosisCondition, + selectedICD: selectedICD, + doctorID: element.doctorID, + doctorName: element.doctorName, + createdBy: element.createdBy, + createdOn: element.createdOn, + icdCode10ID: element.icdCode10ID); widget.mySelectedAssessmentList.add(temMySelectedAssessment); } - }); } widget.changeLoadingState(false); - }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, // baseViewModel: model, body: SingleChildScrollView( physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, + child: Container( + color: Color(0xffF8F8F8), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: + Border.all(color: Colors.grey[200], width: 0.5), ), - HeaderBodyExpandableNotifier( + child: HeaderBodyExpandableNotifier( headerWidget: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - Texts(TranslationBase.of(context).assessment.toUpperCase(), - variant: - isAssessmentExpand ? "bodyText" : '', - bold: isAssessmentExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], + Padding( + padding: EdgeInsets.all(12.0), + child: Row( + children: [ + Texts( + TranslationBase.of(context) + .assessment, + variant: isAssessmentExpand + ? "bodyText" + : '', + bold: + isAssessmentExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: Colors.black, + size: 10, + ) + ], + ), ), InkWell( onTap: () { setState(() { - isAssessmentExpand = !isAssessmentExpand; + isAssessmentExpand = + !isAssessmentExpand; }); }, child: Icon(isAssessmentExpand - ? EvaIcons.minus - : EvaIcons.plus)) + ? EvaIcons.arrowUp + : EvaIcons.arrowDown)) ], ), bodyWidget: Column(children: [ @@ -156,24 +181,23 @@ class _UpdateAssessmentPageState extends State { Column( children: [ Container( - margin: - EdgeInsets.only(left: 5, right: 5, top: 15), + margin: EdgeInsets.only( + left: 5, right: 5, top: 15), child: TextFields( - hintText: TranslationBase.of(context).addAssessment, + hintText: TranslationBase.of(context) + .addAssessment, fontSize: 13.5, onTapTextFields: () { - openAssessmentDialog(context,isUpdate: false, - model: model); + openAssessmentDialog(context, + isUpdate: false, model: model); }, readOnly: true, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal - .appPrimaryColor, + suffixIcon: EvaIcons.plusSquare, + suffixIconColor: Colors.black, fontWeight: FontWeight.w600, validator: (value) { if (value == null) - return TranslationBase - .of(context) + return TranslationBase.of(context) .emptyMessage; else return null; @@ -182,182 +206,203 @@ class _UpdateAssessmentPageState extends State { SizedBox( height: 20, ), - Column( - children: widget.mySelectedAssessmentList.map(( - assessment) { + children: widget.mySelectedAssessmentList + .map((assessment) { return Container( margin: EdgeInsets.only( left: 5, right: 5, top: 15), child: Row( - mainAxisAlignment: MainAxisAlignment - .spaceBetween, - crossAxisAlignment: CrossAxisAlignment - .start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Column( - mainAxisAlignment: MainAxisAlignment - .start, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( children: [ AppText( - - assessment.createdOn !=null?DateTime.parse(assessment.createdOn).day.toString():DateTime.now().day.toString(), - fontWeight: FontWeight - .bold, - fontSize: 13, - ), - AppText( - Helpers.getMonth(assessment.createdOn !=null?DateTime.parse(assessment.createdOn).month:DateTime.now().month).toUpperCase(), + "ICD : ".toUpperCase(), fontSize: 10, color: Colors.grey, ), + Container( + child: AppText( + assessment.selectedICD + .code + .trim() + .toUpperCase() ?? + "", + fontWeight: + FontWeight.w700, + fontSize: 11, + ), + ), ], - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ + ), Row( mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).ICDName +" : ", - fontWeight: FontWeight - .bold, + TranslationBase.of( + context) + .ICDName + + " : ", fontSize: 13, + color: Colors.grey, ), Container( - width: MediaQuery - .of(context) - .size - .width * 0.29, + width: + MediaQuery.of(context) + .size + .width * + 0.29, child: AppText( - assessment - .selectedICD.description + assessment.selectedICD + .description .toString(), + fontWeight: + FontWeight.w700, fontSize: 10, - color: Colors.grey, ), ), ], ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).appointmentNo, - fontWeight: FontWeight - .bold, - fontSize: 13, + TranslationBase.of( + context) + .appointmentNo, + fontSize: 10, + color: Colors.grey, ), AppText( - assessment - .appointmentId + assessment.appointmentId .toString(), - fontSize: 10, - color: Colors.grey, + fontSize: 11, + fontWeight: + FontWeight.w700, ), ], ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).condition + " : ", - fontWeight: FontWeight - .bold, - fontSize: 13, - ), - AppText( - projectViewModel.isArabic?assessment - .selectedDiagnosisCondition - .nameAr : assessment - .selectedDiagnosisCondition - .nameEn, + TranslationBase.of( + context) + .condition + + " : ", fontSize: 10, color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ AppText( - TranslationBase.of(context).dType+' : ', - fontWeight: FontWeight - .bold, - fontSize: 13, - ), - AppText( - projectViewModel.isArabic?assessment - .selectedDiagnosisType - .nameAr:assessment - .selectedDiagnosisType - .nameEn, - fontSize: 10, - color: Colors.grey, + projectViewModel.isArabic + ? assessment + .selectedDiagnosisCondition + .nameAr + : assessment + .selectedDiagnosisCondition + .nameEn, + fontSize: 11, + fontWeight: + FontWeight.w700, ), ], ), - if(assessment.doctorName != null) Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).doc, - fontWeight: FontWeight - .bold, - fontSize: 13, - ), - AppText( - assessment.doctorName??'', + TranslationBase.of( + context) + .dType + + ' : ', fontSize: 10, color: Colors.grey, ), + AppText( + projectViewModel.isArabic + ? assessment + .selectedDiagnosisType + .nameAr + : assessment + .selectedDiagnosisType + .nameEn, + fontSize: 11, + fontWeight: + FontWeight.w700, + ), ], ), + if (assessment.doctorName != + null) + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of( + context) + .doc, + fontSize: 10, + color: Colors.grey, + ), + AppText( + assessment.doctorName ?? + '', + fontSize: 11, + fontWeight: + FontWeight.w700, + ), + ], + ), SizedBox( height: 6, ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ SizedBox( height: 6, ), AppText( - assessment.remark != null || - assessment.remark == '' - ? TranslationBase.of(context).remarks + " : " - : '', - fontWeight: FontWeight.bold, - fontSize: 13, - ), + assessment.remark != + null || + assessment + .remark == + '' + ? TranslationBase.of( + context) + .remarks + + " : " + : '', + fontSize: 10, + color: Colors.grey, + ), Container( - width: MediaQuery - .of(context) - .size - .width * 0.38, + width: + MediaQuery.of(context) + .size + .width * + 0.38, child: AppText( assessment.remark ?? "", - fontSize: 10, - color: Colors.grey, + fontSize: 11, + fontWeight: + FontWeight.w700, ), ), ], @@ -365,89 +410,143 @@ class _UpdateAssessmentPageState extends State { ], ), Column( - crossAxisAlignment: CrossAxisAlignment - .start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( - children: [ AppText( - "ICD : ".toUpperCase(), - fontWeight: FontWeight - .bold, - fontSize: 13, + assessment.createdOn != + null + ? DateTime.parse( + assessment + .createdOn) + .day + .toString() + : DateTime.now() + .day + .toString(), + fontWeight: + FontWeight.bold, + fontSize: 15, ), - Container( - child: AppText( - assessment.selectedICD - .code.trim() - .toUpperCase() ?? - "", - fontSize: 10, - color: Colors.grey, - ), + AppText(" "), + AppText( + Helpers.getMonth(assessment + .createdOn != + null + ? DateTime.parse( + assessment + .createdOn) + .month + : DateTime.now() + .month) + .toUpperCase(), + fontSize: 13, + color: Colors.grey, ), ], - ) - ], - ), - Column( - children: [ + ), + SizedBox( + height: MediaQuery.of(context) + .size + .height * + 0.05, + ), InkWell( onTap: () { openAssessmentDialog( - context, isUpdate: true, + context, + isUpdate: true, assessment: assessment, model: model); }, - child: Icon(EvaIcons - .edit2Outline), + child: Icon(EvaIcons.edit2), ) ], ), + // Column( + // children: [ + // // SizedBox( + // // height: 60, + // // ), + // InkWell( + // onTap: () { + // openAssessmentDialog( + // context, + // isUpdate: true, + // assessment: assessment, + // model: model); + // }, + // child: Icon(EvaIcons.edit2), + // ) + // ], + // ), ], ), ); - }).toList(),) + }).toList(), + ) ], ) ]), isExpand: isAssessmentExpand, ), - DividerWithSpacesAround( - height: 30, - ), - AppButton( - title: TranslationBase - .of(context) - .next, - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - if (widget.mySelectedAssessmentList.isEmpty) { - helpers.showErrorToast( - TranslationBase.of(context).assessmentErrorMsg); - } else { - widget.changePageViewIndex(3); - widget.changeLoadingState(true); - } - }, - ), - SizedBox( - height: 30, - ), - ], + ), + DividerWithSpacesAround( + height: 30, + ), + Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: AppButton( + title: 'Previous', + color: Colors.white38, + fontColor: Colors.black, + fontWeight: FontWeight.w700, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.05, + ), + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w700, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + if (widget.mySelectedAssessmentList.isEmpty) { + helpers.showErrorToast( + TranslationBase.of(context) + .assessmentErrorMsg); + } else { + widget.changePageViewIndex(3); + widget.changeLoadingState(true); + } + }, + ), + ), + ], + ), + SizedBox( + height: 30, + ), + ], + ), ), ), ), ))); } - openAssessmentDialog(BuildContext context, - { - MySelectedAssessment assessment, bool isUpdate, - SOAPViewModel model - }) { + {MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) { if (assessment == null) { assessment = MySelectedAssessment( remark: '', appointmentId: widget.patientInfo.appointmentNo); @@ -466,23 +565,26 @@ class _UpdateAssessmentPageState extends State { bool isUpdate) async { setState(() { widget.mySelectedAssessmentList.add(mySelectedAssessment); - }); }); }); } - } class AddAssessmentDetails extends StatefulWidget { final MySelectedAssessment mySelectedAssessment; final List mySelectedAssessmentList; - final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) addSelectedAssessment; + final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) + addSelectedAssessment; final PatiantInformtion patientInfo; final bool isUpdate; AddAssessmentDetails( - {Key key, this.mySelectedAssessment, this.addSelectedAssessment, this.patientInfo, this.isUpdate = false, this.mySelectedAssessmentList}); - + {Key key, + this.mySelectedAssessment, + this.addSelectedAssessment, + this.patientInfo, + this.isUpdate = false, + this.mySelectedAssessmentList}); @override _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); @@ -505,54 +607,47 @@ class _AddAssessmentDetailsState extends State { remarkController.text = widget.mySelectedAssessment.remark ?? ""; appointmentIdController.text = widget.mySelectedAssessment.appointmentId.toString(); - if(widget.isUpdate){ - if(widget.mySelectedAssessment - .selectedDiagnosisCondition != null) - conditionController.text = projectViewModel.isArabic - ? widget.mySelectedAssessment - .selectedDiagnosisCondition - .nameAr - : widget.mySelectedAssessment - .selectedDiagnosisCondition - .nameEn; - if(widget.mySelectedAssessment - .selectedDiagnosisType !=null) - typeController.text = projectViewModel.isArabic - ? widget.mySelectedAssessment - .selectedDiagnosisType - .nameAr - : widget.mySelectedAssessment - .selectedDiagnosisType - .nameEn; - if(widget.mySelectedAssessment.selectedICD !=null) - icdNameController.text = widget.mySelectedAssessment.selectedICD.code; + if (widget.isUpdate) { + if (widget.mySelectedAssessment.selectedDiagnosisCondition != null) + conditionController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment.selectedDiagnosisCondition.nameAr + : widget.mySelectedAssessment.selectedDiagnosisCondition.nameEn; + if (widget.mySelectedAssessment.selectedDiagnosisType != null) + typeController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment.selectedDiagnosisType.nameAr + : widget.mySelectedAssessment.selectedDiagnosisType.nameEn; + if (widget.mySelectedAssessment.selectedICD != null) + icdNameController.text = widget.mySelectedAssessment.selectedICD.code; } final screenSize = MediaQuery.of(context).size; InputDecoration textFieldSelectorDecoration( String hintText, String selectedText, bool isDropDown, {IconData icon}) { return InputDecoration( + fillColor: Colors.white, contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), borderRadius: BorderRadius.circular(8), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), borderRadius: BorderRadius.circular(8), ), disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), + borderSide: BorderSide(color: Color(0Xffffffff), width: 1.0), borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, + filled: true, hintStyle: TextStyle( - fontSize: 10, - color: Theme.of(context).hintColor, - fontWeight: FontWeight.w700), + fontSize: 10, + color: Colors.grey.shade600, + ), ); } + return FractionallySizedBox( heightFactor: 0.75, child: BaseView( @@ -567,393 +662,422 @@ class _AddAssessmentDetailsState extends State { await model.getMasterLookup(MasterKeysService.ICD10); } }, - builder: (_, model, w) => - AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).addAssessmentDetails.toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 13, - ), - SizedBox( - height: 16, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hintText: TranslationBase.of(context).appointmentNumber, - fontSize: 13.5, - // hintColor: Colors.black, - hasLabelText: appointmentIdController.text != ''?true:false, - showLabelText: true, - fontWeight: FontWeight.w600, - readOnly: true, - controller: appointmentIdController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + Row( + children: [ + AppText( + TranslationBase.of(context) + .addAssessmentDetails + .toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 13, + ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.42, + ), + InkWell( + child: Icon( + Icons.close, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ), + ], + ), + SizedBox( + height: 16, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: AppTextFieldCustom( + height: 55.0, + hintText: + TranslationBase.of(context).appointmentNumber, + //fontSize: 13.5, + // hintColor: Colors.black, + //hasLabelText: appointmentIdController.text != '' + // ? true + // : false, + //showLabelText: true, + //fontWeight: FontWeight.w600, + //readOnly: true, + isDropDown: false, + enabled: false, + controller: appointmentIdController, + // validator: (value) { + // if (value == null) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + ), + ), + SizedBox( + height: 10, + ), + Container( + height: 55.0, + child: InkWell( + onTap: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment + .selectedICD = null; + icdNameController.text = null; + }); + } + : null, + child: widget + .mySelectedAssessment.selectedICD == + null + ? AutoCompleteTextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .nameOrICD, + widget.mySelectedAssessment + .selectedICD != + null + ? widget.mySelectedAssessment + .selectedICD.nameEn + : null, + true, + icon: Icons.keyboard_arrow_down), + itemSubmitted: (item) => setState(() { + widget.mySelectedAssessment + .selectedICD = item; + icdNameController.text = item.code; }), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.080, - child: InkWell( - onTap: model.listOfICD10 != null + key: key, + suggestions: model.listOfICD10, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts(suggestion + .description + + " / " + + suggestion.code.toString()), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.description + .toLowerCase() + .startsWith( + input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith( + input.toLowerCase()) || + suggestion.code + .toLowerCase() + .startsWith( + input.toLowerCase()), + ) + : AppTextFieldCustom( + onClick: model.listOfICD10 != null ? () { - setState(() { - widget.mySelectedAssessment - .selectedICD = null; - icdNameController.text = null; - }); - } + setState(() { + widget.mySelectedAssessment + .selectedICD = null; + icdNameController.text = null; + }); + } : null, - child: widget.mySelectedAssessment.selectedICD == null ? AutoCompleteTextField( - decoration: textFieldSelectorDecoration( - TranslationBase - .of(context) - .nameOrICD, - widget.mySelectedAssessment.selectedICD != - null ? widget.mySelectedAssessment - .selectedICD.nameEn : null, true, - icon: EvaIcons.search), - itemSubmitted: (item) => - setState(() - { - widget.mySelectedAssessment - .selectedICD = item; - icdNameController.text =item.code; - }), - key: key, - suggestions: model.listOfICD10, - itemBuilder: (context, suggestion) => - new Padding( - child: Texts( - suggestion.description + " / " + - suggestion.code.toString()), - padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.description.toLowerCase().startsWith( - input.toLowerCase()) || - suggestion.description.toLowerCase() - .startsWith(input.toLowerCase()) - || suggestion.code.toLowerCase().startsWith( - input.toLowerCase()) - , - ) - : TextFields( - onTapTextFields: model.listOfICD10 != null - ? () { - setState(() { - widget.mySelectedAssessment.selectedICD = - null; - icdNameController.text = null; - }); - } - : null, - hasLabelText: icdNameController.text != - '' ? true : false, - showLabelText: true, - hintText: TranslationBase - .of(context) - .nameOrICD, - fontSize: 13.5, - readOnly: true, - fontWeight: FontWeight.w600, - maxLines: 2, - minLines: 1, - controller: icdNameController, - suffixIcon: EvaIcons.search, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }) + //hasLabelText: + // icdNameController.text != '' + // ? true + // : false, + //showLabelText: true, + hintText: TranslationBase.of(context) + .nameOrICD, - // TextField( - // decoration: textFieldSelectorDecoration( - // widget.mySelectedAssessment.selectedICD != - // null ? widget.mySelectedAssessment - // .selectedICD.code : "Name or ICD", - // widget.mySelectedAssessment.selectedICD != - // null ? projectViewModel.isArabic - // ? widget.mySelectedAssessment - // .selectedICD.nameAr - // : widget.mySelectedAssessment - // .selectedICD.nameEn : null, true, - // icon: EvaIcons.search), - // enabled: false, - // ), - ), - ), - if(isFormSubmitted && - widget.mySelectedAssessment - .selectedICD == null) - CustomValidationError(), - SizedBox( - height: 10, - ), - TextFields( - onTapTextFields: model - .listOfDiagnosisCondition != - null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisCondition, - okText: TranslationBase - .of(context) - .ok, - okFunction: ( - MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment + //fontSize: 13.5, + //readOnly: true, + //fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: icdNameController, + //suffixIcon: EvaIcons.search, + // validator: (value) { + // if (value == null) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + + isDropDown: true, + enabled: false, + height: 55.0, + ) + + // TextField( + // decoration: textFieldSelectorDecoration( + // widget.mySelectedAssessment.selectedICD != + // null ? widget.mySelectedAssessment + // .selectedICD.code : "Name or ICD", + // widget.mySelectedAssessment.selectedICD != + // null ? projectViewModel.isArabic + // ? widget.mySelectedAssessment + // .selectedICD.nameAr + // : widget.mySelectedAssessment + // .selectedICD.nameEn : null, true, + // icon: EvaIcons.search), + // enabled: false, + // ), + ), + ), + if (isFormSubmitted && + widget.mySelectedAssessment.selectedICD == null) + CustomValidationError(), + SizedBox( + height: 7, + ), + AppTextFieldCustom( + height: 55.0, + onClick: model.listOfDiagnosisCondition != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisCondition, + okText: TranslationBase.of(context).ok, + okFunction: + (MasterKeyModel selectedValue) { + setState(() { + widget.mySelectedAssessment .selectedDiagnosisCondition = - selectedValue; - conditionController.text = - projectViewModel.isArabic - ? widget.mySelectedAssessment + selectedValue; + conditionController + .text = projectViewModel + .isArabic + ? widget + .mySelectedAssessment .selectedDiagnosisCondition .nameAr - : widget.mySelectedAssessment + : widget + .mySelectedAssessment .selectedDiagnosisCondition .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hasLabelText: conditionController.text != - '' ? true : false, - showLabelText: true, - hintText: TranslationBase - .of(context) - .condition, - fontSize: 13.5, - readOnly: true, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 2, - minLines: 1, - controller: conditionController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - if(isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisCondition == null) - CustomValidationError(), - SizedBox( - height: 10, - ), - + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + //hasLabelText: + // conditionController.text != '' ? true : false, + //showLabelText: true, + hintText: TranslationBase.of(context).condition, + //fontSize: 13.5, + //readOnly: true, + //suffixIcon: EvaIcons.arrowDown, + // hintColor: Colors.black, + //fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: conditionController, + // validator: (value) { + // if (value == null) + // return TranslationBase.of(context).emptyMessage; + // else + // return null; + // }, - TextFields( - onTapTextFields: model - .listOfDiagnosisType != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisType, - okText: TranslationBase - .of(context) - .ok, - okFunction: ( - MasterKeyModel selectedValue) { - setState(() { - // _selectedDiagnosisType = - // selectedValue; - widget.mySelectedAssessment + isDropDown: true, + enabled: false, + ), + if (isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisCondition == + null) + CustomValidationError(), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: 55.0, + onClick: model.listOfDiagnosisType != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisType, + okText: TranslationBase.of(context).ok, + okFunction: + (MasterKeyModel selectedValue) { + setState(() { + // _selectedDiagnosisType = + // selectedValue; + widget.mySelectedAssessment .selectedDiagnosisType = - selectedValue; - typeController.text = + selectedValue; + typeController.text = projectViewModel.isArabic - ? selectedValue - .nameAr - : selectedValue - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hasLabelText: typeController.text != - '' ? true : false, - showLabelText: true, - hintText: TranslationBase - .of(context) - .dType, - fontSize: 13.5, - readOnly: true, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 2, - minLines: 1, - controller: typeController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - if(isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisType == null) - CustomValidationError(), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hintText: TranslationBase - .of(context) - .remarks, - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 18, - minLines: 5, - hasLabelText: remarkController.text != - '' ? true : false, - showLabelText: true, - controller: remarkController, - onChanged: (value) { - widget.mySelectedAssessment.remark = - remarkController.text; - }, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 10, - ), - AppButton( - title: (widget.isUpdate?TranslationBase.of(context).update:TranslationBase.of(context).add).toUpperCase(), - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - setState(() { - isFormSubmitted = true; - }); - widget.mySelectedAssessment.remark = - remarkController.text; - widget.mySelectedAssessment - .appointmentId = int.parse( - appointmentIdController.text); - if (widget.mySelectedAssessment - .selectedDiagnosisCondition != - null && - widget.mySelectedAssessment - .selectedDiagnosisType != - null && - widget.mySelectedAssessment - .selectedICD != null) { - await submitAssessment( - isUpdate: widget.isUpdate, - model: model, - mySelectedAssessment: widget - .mySelectedAssessment); - } - }, - ), - ])), - ), - ), - ))), + ? selectedValue.nameAr + : selectedValue.nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + //hasLabelText: + // typeController.text != '' ? true : false, + //prefixIcon: Icon(Icons.add), + //showLabelText: true, + hintText: TranslationBase.of(context).dType, + //fontSize: 13.5, + //readOnly: true, + // hintColor: Colors.black, + //suffixIcon: EvaIcons.arrowDown, + //fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + enabled: false, + isDropDown: true, + + controller: typeController, + // validator: (value) { + // if (value == null) + // return TranslationBase.of(context).emptyMessage; + // else + // return null; + // }, + ), + if (isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisType == + null) + CustomValidationError(), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 18, + minLines: 5, + hasLabelText: + remarkController.text != '' ? true : false, + showLabelText: true, + controller: remarkController, + onChanged: (value) { + widget.mySelectedAssessment.remark = + remarkController.text; + }, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + AppButton( + fontWeight: FontWeight.w700, + color: Colors.green, + title: (widget.isUpdate + ? 'Update Assessment Details' + : 'Add Assessment Details'), + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + setState(() { + isFormSubmitted = true; + }); + widget.mySelectedAssessment.remark = + remarkController.text; + widget.mySelectedAssessment.appointmentId = + int.parse(appointmentIdController.text); + if (widget.mySelectedAssessment + .selectedDiagnosisCondition != + null && + widget.mySelectedAssessment + .selectedDiagnosisType != + null && + widget.mySelectedAssessment.selectedICD != + null) { + await submitAssessment( + isUpdate: widget.isUpdate, + model: model, + mySelectedAssessment: + widget.mySelectedAssessment); + } + }, + ), + ])), + ), + ), + ))), ); } submitAssessment( - {SOAPViewModel model, MySelectedAssessment mySelectedAssessment, bool isUpdate = false}) async { + {SOAPViewModel model, + MySelectedAssessment mySelectedAssessment, + bool isUpdate = false}) async { if (isUpdate) { - PatchAssessmentReqModel patchAssessmentReqModel = - PatchAssessmentReqModel( + PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( patientMRN: widget.patientInfo.patientMRN, episodeID: widget.patientInfo.episodeNo, appointmentNo: widget.patientInfo.appointmentNo, remarks: mySelectedAssessment.remark, complexDiagnosis: true, - conditionId: - mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: - mySelectedAssessment.selectedDiagnosisType.id, + conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, icdcode10Id: mySelectedAssessment.selectedICD.code, - prevIcdCode10ID: mySelectedAssessment.icdCode10ID - ); + prevIcdCode10ID: mySelectedAssessment.icdCode10ID); await model.patchAssessment(patchAssessmentReqModel); } else { PostAssessmentRequestModel postAssessmentRequestModel = - new PostAssessmentRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - icdCodeDetails: [ + new PostAssessmentRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + icdCodeDetails: [ new IcdCodeDetails( remarks: mySelectedAssessment.remark, complexDiagnosis: true, - conditionId: - mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: - mySelectedAssessment.selectedDiagnosisType.id, + conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, + diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, icdcode10Id: mySelectedAssessment.selectedICD.code) ]); await model.postAssessment(postAssessmentRequestModel); } - if (model.state == ViewState.ErrorLocal) { - helpers - .showErrorToast(model.error); + helpers.showErrorToast(model.error); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -963,17 +1087,15 @@ class _AddAssessmentDetailsState extends State { if (!isUpdate) { // widget.mySelectedAssessmentList.add(mySelectedAssessment); - widget.addSelectedAssessment(mySelectedAssessment,isUpdate); + widget.addSelectedAssessment(mySelectedAssessment, isUpdate); } Navigator.of(context).pop(); } - // widget.changePageViewIndex(3); } } - class PatchAssessmentReqModel { int patientMRN; int appointmentNo; @@ -987,14 +1109,14 @@ class PatchAssessmentReqModel { PatchAssessmentReqModel( {this.patientMRN, - this.appointmentNo, - this.episodeID, - this.icdcode10Id, - this.prevIcdCode10ID, - this.conditionId, - this.diagnosisTypeId, - this.complexDiagnosis, - this.remarks}); + this.appointmentNo, + this.episodeID, + this.icdcode10Id, + this.prevIcdCode10ID, + this.conditionId, + this.diagnosisTypeId, + this.complexDiagnosis, + this.remarks}); PatchAssessmentReqModel.fromJson(Map json) { patientMRN = json['PatientMRN']; @@ -1022,5 +1144,3 @@ class PatchAssessmentReqModel { return data; } } - -