move error to model

merge-requests/787/head
Elham Rababh 3 years ago
parent 6db5191e07
commit 41190bc501

@ -93,6 +93,9 @@ class SOAPViewModel extends BaseViewModel {
bool isAddProgress = true;
String progressNoteText ="";
String complaintsControllerError = '';
String medicationControllerError = '';
String illnessControllerError = '';
get medicationStrengthList => _SOAPService.medicationStrengthListWithModel;
get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel;

@ -55,9 +55,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
TextEditingController illnessController = TextEditingController();
TextEditingController complaintsController = TextEditingController();
TextEditingController medicationController = TextEditingController();
String complaintsControllerError = '';
String medicationControllerError = '';
String illnessControllerError = '';
final formKey = GlobalKey<FormState>();
List<MySelectedAllergy> myAllergiesList = List();
List<MySelectedHistory> myHistoryList = List();
@ -95,7 +93,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(
MySelectedHistory mySelectedHistory =
SoapUtils.generateMySelectedHistory(
history: history,
isChecked: element.isChecked,
remark: element.remarks,
@ -110,7 +109,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(
MySelectedHistory mySelectedHistory =
SoapUtils.generateMySelectedHistory(
history: history,
isChecked: element.isChecked,
remark: element.remarks,
@ -125,7 +125,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(
MySelectedHistory mySelectedHistory =
SoapUtils.generateMySelectedHistory(
history: history,
isChecked: element.isChecked,
remark: element.remarks,
@ -140,7 +141,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(
MySelectedHistory mySelectedHistory =
SoapUtils.generateMySelectedHistory(
history: history,
isChecked: element.isChecked,
remark: element.remarks,
@ -209,7 +211,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
model.setSubjectiveCallBack(this);
GetChiefComplaintReqModel getChiefComplaintReqModel =
GetChiefComplaintReqModel(
admissionNo: int.parse(widget.patientInfo.admissionNo),patientMRN: widget.patientInfo.patientMRN,
admissionNo: widget.patientInfo.admissionNo == null
? 0
: int.parse(widget.patientInfo.admissionNo),
patientMRN: widget.patientInfo.patientMRN,
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()),
episodeId: widget.patientInfo.episodeNo,
@ -260,9 +265,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
complaintsController: complaintsController,
illnessController: illnessController,
medicationController: medicationController,
complaintsControllerError: complaintsControllerError,
illnessControllerError: illnessControllerError,
medicationControllerError: medicationControllerError,
complaintsControllerError: model.complaintsControllerError,
illnessControllerError: model.illnessControllerError,
medicationControllerError: model.medicationControllerError,
),
isExpanded: isChiefExpand,
),
@ -331,9 +336,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
formKey.currentState.save();
formKey.currentState.validate();
complaintsControllerError = '';
medicationControllerError = '';
illnessControllerError = '';
model.complaintsControllerError = '';
model.medicationControllerError = '';
model.illnessControllerError = '';
if (complaintsController.text.isNotEmpty &&
illnessController.text.isNotEmpty &&
complaintsController.text.length > 25) {
@ -359,18 +364,18 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
} else {
setState(() {
if (complaintsController.text.isEmpty) {
complaintsControllerError = TranslationBase.of(context).emptyMessage;
model.complaintsControllerError = TranslationBase.of(context).emptyMessage;
} else if (complaintsController.text.length < 25) {
complaintsControllerError =
model.complaintsControllerError =
TranslationBase.of(context).chiefComplaintLength;
}
if (illnessController.text.isEmpty) {
illnessControllerError = TranslationBase.of(context).emptyMessage;
model.illnessControllerError = TranslationBase.of(context).emptyMessage;
}
if (medicationController.text.isEmpty) {
medicationControllerError = TranslationBase.of(context).emptyMessage;
model.medicationControllerError = TranslationBase.of(context).emptyMessage;
}
});
@ -464,7 +469,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
if (formKey.currentState.validate()) {
PostChiefComplaintRequestModel postChiefComplaintRequestModel =
new PostChiefComplaintRequestModel(
admissionNo: int.parse(widget.patientInfo.admissionNo),patientMRN: widget.patientInfo.patientMRN,
admissionNo: widget.patientInfo.admissionNo == null
? 0
: int.parse(widget.patientInfo.admissionNo),
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo,
chiefComplaint: complaintsController.text,

Loading…
Cancel
Save