Merge branch 'fix_medical_report' into 'development'

Fix medical report

See merge request Cloud_Solution/doctor_app_flutter!734
merge-requests/733/merge
Mohammad Aljammal 4 years ago
commit d2e0555144

@ -25,12 +25,24 @@ class PatientMedicalReportViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
bool hasOnHold(){
bool hasHold = false;
medicalReportList.forEach((element) {
if(element.status == 1){
hasHold = true;
}
});
return hasHold;
}
Future getMedicalReportTemplate() async {
setState(ViewState.Busy);
setState(ViewState.BusyLocal);
await _service.getMedicalReportTemplate();
if (_service.hasError) {
error = _service.error;
setState(ViewState.Error);
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}

@ -6,6 +6,7 @@ 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/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
@ -40,27 +41,35 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
? TranslationBase.of(context).medicalReportAdd
: TranslationBase.of(context).medicalReportVerify,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: Column(
children: [
Expanded(
child: Container(
margin: EdgeInsets.all(16),
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
body: model.state == ViewState.BusyLocal
? AppLoaderWidget()
: Column(
children: [
Expanded(
child: Container(
margin: EdgeInsets.all(16),
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (model.medicalReportTemplate.length > 0)
// if (model.medicalReportTemplate.length > 0)
HtmlRichEditor(
initialText: model
.medicalReportTemplate[0]
.templateTextHtml,
initialText: (medicalReport != null
? medicalReport.reportDataHtml
: model.medicalReportTemplate
.length > 0 ? model
.medicalReportTemplate[0] : ""),
hint: "Write the medical report ",
height:
MediaQuery.of(context).size.height *
0.75,
MediaQuery
.of(context)
.size
.height *
0.75,
),
],
),

@ -7,6 +7,7 @@ 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/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart';
@ -17,7 +18,6 @@ import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:provider/provider.dart';
import '../../../../routes.dart';
@ -75,13 +75,18 @@ class MedicalReportPage extends StatelessWidget {
),
AddNewOrder(
onTap: () {
Navigator.of(context)
.pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD
});
if (model.hasOnHold()) {
Helpers.showErrorToast(
"Please Verified the on hold report to be able to add new one");
} else {
Navigator.of(context)
.pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: {
'patient': patient,
'patientType': patientType,
'arrivalType': arrivalType,
'type': MedicalReportStatus.ADD
});
}
},
label: TranslationBase.of(context).createNewMedicalReport,
),
@ -92,7 +97,7 @@ class MedicalReportPage extends StatelessWidget {
onTap: () {
if (model.medicalReportList[index].status == 1) {
Navigator.of(context).pushNamed(
PATIENT_MEDICAL_REPORT_DETAIL,
PATIENT_MEDICAL_REPORT_INSERT,
arguments: {
'patient': patient,
'patientType': patientType,
@ -101,7 +106,7 @@ class MedicalReportPage extends StatelessWidget {
});
} else {
Navigator.of(context).pushNamed(
PATIENT_MEDICAL_REPORT_INSERT,
PATIENT_MEDICAL_REPORT_DETAIL,
arguments: {
'patient': patient,
'patientType': patientType,
@ -116,7 +121,7 @@ class MedicalReportPage extends StatelessWidget {
child: CardWithBgWidget(
hasBorder: false,
bgColor: model.medicalReportList[index].status == 1
? Colors.red[700]
? Color(0xFFCC9B14)
: Colors.green[700],
widget: Column(
children: [
@ -132,9 +137,9 @@ class MedicalReportPage extends StatelessWidget {
: TranslationBase.of(context)
.verified,
color: model.medicalReportList[index]
.status ==
1
? Colors.red[700]
.status ==
1
? Color(0xFFCC9B14)
: Colors.green[700],
fontSize: 1.4 * SizeConfig.textMultiplier,
bold: true,
@ -226,8 +231,8 @@ class MedicalReportPage extends StatelessWidget {
Icon(
model.medicalReportList[index].status ==
1
? EvaIcons.eye
: DoctorApp.edit_1,
? DoctorApp.edit_1
:EvaIcons.eye ,
),
],
),

Loading…
Cancel
Save