From 15d7c8c8a648eab71e5f494eb61d88279c76f765 Mon Sep 17 00:00:00 2001
From: Will Sheldon <114631109+wssheldon@users.noreply.github.com>
Date: Tue, 5 Dec 2023 07:20:38 -0800
Subject: [PATCH] Require all fields but tags, fix Submit button validation
(#4080)
---
.../src/case/ReportSubmissionCard.vue | 130 +++++++++++-------
1 file changed, 82 insertions(+), 48 deletions(-)
diff --git a/src/dispatch/static/dispatch/src/case/ReportSubmissionCard.vue b/src/dispatch/static/dispatch/src/case/ReportSubmissionCard.vue
index 63ac38a36fc3..8f60ec7ad108 100644
--- a/src/dispatch/static/dispatch/src/case/ReportSubmissionCard.vue
+++ b/src/dispatch/static/dispatch/src/case/ReportSubmissionCard.vue
@@ -1,11 +1,10 @@
-
+
@@ -32,50 +31,48 @@
mdi-open-in-new
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,7 +81,7 @@
variant="flat"
block
:loading="loading"
- :disabled="!isValid.value"
+ :disabled="!formIsValid"
@click="report()"
>
Submit
@@ -128,6 +125,12 @@ export default {
return {
isSubmitted: false,
project_faq: null,
+ formIsValid: false,
+ titleValid: false,
+ descriptionValid: false,
+ projectValid: false,
+ caseTypeValid: false,
+ casePriorityValid: false,
}
},
@@ -148,6 +151,29 @@ export default {
]),
},
+ watch: {
+ title() {
+ this.titleValid = !!this.title
+ this.checkFormValidity()
+ },
+ description() {
+ this.descriptionValid = !!this.description
+ this.checkFormValidity()
+ },
+ project() {
+ this.projectValid = !!this.project
+ this.checkFormValidity()
+ },
+ case_type() {
+ this.caseTypeValid = !!this.case_type
+ this.checkFormValidity()
+ },
+ case_priority() {
+ this.casePriorityValid = !!this.case_priority
+ this.checkFormValidity()
+ },
+ },
+
methods: {
getFAQ() {
if (this.project) {
@@ -198,6 +224,14 @@ export default {
}
)
},
+ checkFormValidity() {
+ this.formIsValid =
+ this.titleValid &&
+ this.descriptionValid &&
+ this.projectValid &&
+ this.caseTypeValid &&
+ this.casePriorityValid
+ },
...mapActions("case_management", ["report", "get", "resetSelected"]),
},