Commit f0314d47 authored by devendra's avatar devendra
Browse files

Fix: assessor form validation changes

No related merge requests found
Showing with 24 additions and 6 deletions
+24 -6
......@@ -67,5 +67,6 @@
"preview": "Preview",
"remove": "Remove",
"attachment": "Attachment",
"version": "Version"
"version": "Version",
"canNotSubmitEmptyForm": "Empty assessment can't be submitted"
}
\ No newline at end of file
......@@ -164,7 +164,7 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
updatedFields = {},
value.forEach((childKey, childValue) => {
updatedFields[childKey] = {
childValue: {'value': 'Correct', 'comments': ''}
childValue: {'value': '', 'comments': ''}
}
}),
_data[key] = updatedFields
......@@ -266,6 +266,7 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
if (isInternetConnected) {
_validateUser();
}
if (_isleadInspector) {
Map data = {
'applicationId': widget.application.applicationId,
......@@ -273,6 +274,22 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
'dataObject': _data
};
//Validate assessment form to make sure some inputs are given by the assessor
int fieldsLength = _data.keys.length;
bool isValidForm = false;
for (int i = 0; i < fieldsLength; i++) {
_data[_data.keys.elementAt(i)].forEach((key, value) {
if (value[value.keys.elementAt(0)]["value"].isNotEmpty) {
isValidForm = true;
}
});
}
if (!isValidForm) {
Helper.toastMessage("Empty assessment can't be submitted");
return;
}
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => InspectionSummaryPage(
// formId: widget.formId,
......
......@@ -543,14 +543,14 @@ class _LeadInspectorApplicationFieldState
if (widget.applicationStatus !=
InspectionStatus
.inspectionCompleted &&
_radioValue.toLowerCase() !=
FieldValue.correct
_radioValue.toLowerCase() ==
FieldValue.inCorrect
.toLowerCase()) {
_displayCommentDialog();
}
},
icon: _radioValue.toLowerCase() !=
FieldValue.correct
icon: _radioValue.toLowerCase() ==
FieldValue.inCorrect
.toLowerCase() &&
widget.applicationStatus !=
InspectionStatus
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment