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; bool isAddProgress = true;
String progressNoteText =""; String progressNoteText ="";
String complaintsControllerError = '';
String medicationControllerError = '';
String illnessControllerError = '';
get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; get medicationStrengthList => _SOAPService.medicationStrengthListWithModel;
get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel;

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

Loading…
Cancel
Save