diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index be80fc689d7c9aed1b34fe256e194b1529c86c97..dd27d612675da7ca8b6ef9d8ad73a955d12afbbd 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -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 diff --git a/lib/pages/application_details_page.dart b/lib/pages/application_details_page.dart index 3798fcb58242eb98f34955ea285cfa1f61d63666..0dca0450622061e42e8bb48722007e30c774e250 100644 --- a/lib/pages/application_details_page.dart +++ b/lib/pages/application_details_page.dart @@ -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, diff --git a/lib/widgets/lead_inspector_application_field.dart b/lib/widgets/lead_inspector_application_field.dart index b8c56545a6bcb8103031798acc254d41affe6fb1..686593987fea7b749001ca9eb79d2f0b8cd736f4 100644 --- a/lib/widgets/lead_inspector_application_field.dart +++ b/lib/widgets/lead_inspector_application_field.dart @@ -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