@ -1,15 +1,16 @@
import ' package:autocomplete_textfield/autocomplete_textfield.dart ' ;
import ' package:doctor_app_flutter/client/base_app_client.dart ' ;
import ' package:doctor_app_flutter/config/config.dart ' ;
import ' package:doctor_app_flutter/core/enum/master_lookup_key.dart ' ;
import ' package:doctor_app_flutter/core/enum/viewstate.dart ' ;
import ' package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart ' ;
import ' package:doctor_app_flutter/core/viewModel/project_view_model.dart ' ;
import ' package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart ' ;
import ' package:doctor_app_flutter/models/SOAP/master_key_model.dart ' ;
import ' package:doctor_app_flutter/models/SOAP/my_selected_assement.dart ' ;
import ' package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart ' ;
import ' package:doctor_app_flutter/models/patient/patiant_info_model.dart ' ;
import ' package:doctor_app_flutter/screens/base/base_view.dart ' ;
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 ' ;
@ -22,6 +23,7 @@ import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.
import ' package:eva_icons_flutter/eva_icons_flutter.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:font_awesome_flutter/font_awesome_flutter.dart ' ;
import ' package:provider/provider.dart ' ;
import ' custom_validation_error.dart ' ;
@ -29,11 +31,12 @@ class UpdateAssessmentPage extends StatefulWidget {
final Function changePageViewIndex ;
List < MySelectedAssessment > mySelectedAssessmentList ;
final PatiantInformtion patientInfo ;
final Function changeLoadingState ;
UpdateAssessmentPage ( { Key key ,
this . changePageViewIndex ,
this . mySelectedAssessmentList ,
this . patientInfo }) ;
this . patientInfo , this . changeLoadingState }) ;
@ override
_UpdateAssessmentPageState createState ( ) = > _UpdateAssessmentPageState ( ) ;
@ -43,6 +46,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
bool isAssessmentExpand = false ;
@ override
Widget build ( BuildContext context ) {
ProjectViewModel projectViewModel = Provider . of ( context ) ;
return BaseView < SOAPViewModel > (
onModelReady: ( model ) async {
@ -77,25 +81,32 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
masterKeys: MasterKeysService . DiagnosisCondition ,
id: element . conditionID ,
) ;
MySelectedAssessment temMySelectedAssessment = MySelectedAssessment (
appointmentId: element . appointmentNo ,
remark: element . remarks ,
selectedDiagnosisType: diagnosisType ,
selectedDiagnosisCondition: diagnosisCondition ,
selectedICD: selectedICD ,
doctorID: element . doctorID ,
doctorName: element . doctorName ,
createdBy: element . createdBy ,
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 . mySelectedAssessmentList . add ( temMySelectedAssessment ) ;
} ) ;
}
widget . changeLoadingState ( false ) ;
} ,
builder: ( _ , model , w ) = > AppScaffold (
isShowAppBar: false ,
baseViewModel: model ,
/ / baseViewModel: model ,
body: SingleChildScrollView (
physics: ScrollPhysics ( ) ,
child: Center (
@ -193,13 +204,14 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
CrossAxisAlignment . start ,
children: [
AppText (
" 12 " . toUpperCase ( ) ,
assessment . createdOn ! = null ? DateTime . parse ( assessment . createdOn ) . day . toString ( ) : DateTime . now ( ) . day . toString ( ) ,
fontWeight: FontWeight
. bold ,
fontSize: 16 ,
) ,
AppText (
" DEC " . toUpperCase ( ) ,
Helpers . getMonth ( assessment . createdOn ! = null ? DateTime . parse ( assessment . createdOn ) . month: DateTime . now ( ) . month ) . toUpperCase ( ) ,
fontSize: 10 ,
color: Colors . grey ,
) ,
@ -235,7 +247,9 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
MainAxisAlignment . start ,
children: [
AppText (
assessment
projectViewModel . isArabic ? assessment
. selectedDiagnosisCondition
. nameAr : assessment
. selectedDiagnosisCondition
. nameEn ,
fontWeight: FontWeight
@ -249,13 +263,15 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
MainAxisAlignment . start ,
children: [
AppText (
TranslationBase . of ( context ) . type + ' : ' ,
TranslationBase . of ( context ) . dType + ' : ' ,
fontWeight: FontWeight
. bold ,
fontSize: 16 ,
) ,
AppText (
assessment
projectViewModel . isArabic ? assessment
. selectedDiagnosisType
. nameAr: assessment
. selectedDiagnosisType
. nameEn ,
fontSize: 10 ,
@ -366,6 +382,8 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
loading: model . state = = ViewState . BusyLocal ,
onPressed: ( ) async {
widget . changePageViewIndex ( 3 ) ;
widget . changeLoadingState ( true ) ;
} ,
) ,
SizedBox (
@ -432,6 +450,8 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
@ override
Widget build ( BuildContext context ) {
ProjectViewModel projectViewModel = Provider . of ( context ) ;
remarkController . text = widget . mySelectedAssessment . remark ? ? " " ;
appointmentIdController . text =
widget . mySelectedAssessment . appointmentId . toString ( ) ;
@ -492,7 +512,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
height: 16 ,
) ,
AppText (
" Add Assessment Details " . toUpperCase ( ) ,
TranslationBase . of ( context ) . addAssessmentDetails . toUpperCase ( ) ,
fontWeight: FontWeight . bold ,
fontSize: 16 ,
) ,
@ -532,7 +552,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
}
: null ,
child: widget . mySelectedAssessment . selectedICD = = null ? AutoCompleteTextField < MasterKeyModel > (
decoration: textFieldSelectorDecoration ( " Name or ICD " , widget . mySelectedAssessment . selectedICD ! = null ? widget . mySelectedAssessment . selectedICD . nameEn : null , true , icon: EvaIcons . search ) ,
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 ) ,
key: key ,
suggestions: model . listOfICD10 ,
@ -547,7 +567,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
) : TextField (
decoration: textFieldSelectorDecoration (
widget . mySelectedAssessment . selectedICD ! = null ? widget . mySelectedAssessment . selectedICD . code : " Name or ICD " ,
widget . mySelectedAssessment . selectedICD ! = null ? widget. mySelectedAssessment . selectedICD . nameEn : null , true , icon: EvaIcons . search ) ,
widget . mySelectedAssessment . selectedICD ! = null ? projectViewModel. isArabic ? widget . mySelectedAssessment . selectedICD . nameAr: widget. mySelectedAssessment . selectedICD . nameEn : null , true , icon: EvaIcons . search ) ,
enabled: false ,
) ,
) ,
@ -589,10 +609,12 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
: null ,
child: TextField (
decoration: textFieldSelectorDecoration (
" Condition " ,
TranslationBase . of ( context ) . condition ,
widget . mySelectedAssessment
. selectedDiagnosisCondition ! = null
? widget . mySelectedAssessment
? projectViewModel . isArabic ? widget . mySelectedAssessment
. selectedDiagnosisCondition
. nameAr: widget . mySelectedAssessment
. selectedDiagnosisCondition
. nameEn
: null ,
@ -639,10 +661,11 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
: null ,
child: TextField (
decoration: textFieldSelectorDecoration (
" Type " ,
TranslationBase . of ( context ) . dType ,
widget . mySelectedAssessment
. selectedDiagnosisType ! = null
? widget . mySelectedAssessment
? projectViewModel . isArabic ? widget . mySelectedAssessment
. selectedDiagnosisType . nameAr: widget . mySelectedAssessment
. selectedDiagnosisType . nameEn
: null ,
true ) ,
@ -699,9 +722,6 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
null & &
widget . mySelectedAssessment
. selectedICD ! = null ) {
widget . addSelectedAssessment (
widget . mySelectedAssessment ,
widget . isUpdate ) ;
await submitAssessment (
isUpdate: widget . isUpdate ,
model: model ,
@ -758,7 +778,8 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
if ( model . state = = ViewState . ErrorLocal ) {
helpers . showErrorToast ( model . error ) ;
helpers
. showErrorToast ( model . error ) ;
} else {
mySelectedAssessment . icdCode10ID = mySelectedAssessment . selectedICD . code ;