|
|
|
|
@ -18,6 +18,7 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../../../core/model/SOAP/physical_exam/Category.dart';
|
|
|
|
|
import '../../../../../core/viewModel/project_view_model.dart';
|
|
|
|
|
|
|
|
|
|
class AddDetailsToExaminationVidaPlus extends StatefulWidget {
|
|
|
|
|
@ -25,9 +26,7 @@ class AddDetailsToExaminationVidaPlus extends StatefulWidget {
|
|
|
|
|
final PatiantInformtion patientInfo;
|
|
|
|
|
|
|
|
|
|
const AddDetailsToExaminationVidaPlus(
|
|
|
|
|
{super.key,
|
|
|
|
|
this.mySelectedExamination,
|
|
|
|
|
required this.patientInfo});
|
|
|
|
|
{super.key, this.mySelectedExamination, required this.patientInfo});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<AddDetailsToExaminationVidaPlus> createState() =>
|
|
|
|
|
@ -44,10 +43,11 @@ class _AddDetailsToExaminationVidaPlusState
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
return BaseView<SOAPViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
|
widget.mySelectedExamination?.forEach((value) =>
|
|
|
|
|
model.getSpecialityDetails(
|
|
|
|
|
value.name ?? '', value.id, widget.patientInfo));});
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
|
widget.mySelectedExamination?.forEach((value) =>
|
|
|
|
|
model.getSpecialityDetails(
|
|
|
|
|
value.name ?? '', value.id, widget.patientInfo));
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
@ -68,9 +68,10 @@ class _AddDetailsToExaminationVidaPlusState
|
|
|
|
|
headerTitle: title,
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
if(currentlyExpanded == title) {
|
|
|
|
|
if (currentlyExpanded == title) {
|
|
|
|
|
currentlyExpanded = '';
|
|
|
|
|
}else currentlyExpanded = title;
|
|
|
|
|
} else
|
|
|
|
|
currentlyExpanded = title;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: ExaminationItems(
|
|
|
|
|
@ -115,26 +116,48 @@ class _AddDetailsToExaminationVidaPlusState
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
var listOfSelectedCategory = model.getListOfSelectedCategory();
|
|
|
|
|
if(listOfSelectedCategory.isEmpty){
|
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).kindlySelectCategory);
|
|
|
|
|
var listOfSelectedCategory =
|
|
|
|
|
model.getListOfSelectedCategory();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (listOfSelectedCategory.isEmpty) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.kindlySelectCategory);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(listOfSelectedCategory.any((value) => value.remarksController.text.isEmpty)){
|
|
|
|
|
/* if (listOfSelectedCategory.any((value) {
|
|
|
|
|
return value.remarksController.text.isEmpty && value.conditionsList?.firstWhere((item){
|
|
|
|
|
return item.conditionName == value.selectedCondition;
|
|
|
|
|
}).conditionCode?.toLowerCase() == TranslationBase.of(context).normal.toLowerCase();
|
|
|
|
|
})) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.remarksCanNotBeEmpty);
|
|
|
|
|
return;
|
|
|
|
|
}*/
|
|
|
|
|
if(listOfSelectedCategory.any((value) {
|
|
|
|
|
print('the value is ${value.selectedConditionName}');
|
|
|
|
|
return value.remarksController.text.isEmpty == true && value.selectedConditionName.isNotEmpty &&value.selectedConditionName != TranslationBase.of(context).normal.toLowerCase(); })) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var result = await model.postPhysicalExamination(widget.patientInfo,listOfSelectedCategory);
|
|
|
|
|
if(result){
|
|
|
|
|
model.getPhysicalExamination(widget.patientInfo);
|
|
|
|
|
Navigator.popUntil(context, ((route) {
|
|
|
|
|
if (route.settings.name == UPDATE_EPISODE_VIDA_PLUS) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
var result =
|
|
|
|
|
await model.postPhysicalExamination(
|
|
|
|
|
widget.patientInfo,
|
|
|
|
|
listOfSelectedCategory);
|
|
|
|
|
if (result) {
|
|
|
|
|
model.getPhysicalExamination(
|
|
|
|
|
widget.patientInfo);
|
|
|
|
|
Navigator.popUntil(context, ((route) {
|
|
|
|
|
if (route.settings.name ==
|
|
|
|
|
UPDATE_EPISODE_VIDA_PLUS) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|