WD: remarks made non_mandatory if condition is normal

update_flutter_3.24_vida_plus_episode
taha.alam 10 months ago
parent ed603c4268
commit ced8e7976f

@ -39,6 +39,7 @@ class Category {
bool isSelected = false;
TextEditingController remarksController = TextEditingController();
int selectedCondition = -1;
String selectedConditionName = "";
String? pomrId;
int? paitientId;
int? userID;

@ -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;
}
}));
}
},
),
),

@ -97,6 +97,8 @@ class _ExaminationItemsState extends State<ExaminationItems> {
itemBuilder: (context, currentIndex) => InkWell(
onTap: () {
setState(() {
value
.selectedConditionName = value.conditionsList?[currentIndex].conditionCode?? '';
value
.selectedCondition =
int.parse(value

Loading…
Cancel
Save