diff --git a/src/dispatch/static/dispatch/src/case/ReportSubmissionCard.vue b/src/dispatch/static/dispatch/src/case/ReportSubmissionCard.vue index 4f84b7430bc5..5f076b65f7c9 100644 --- a/src/dispatch/static/dispatch/src/case/ReportSubmissionCard.vue +++ b/src/dispatch/static/dispatch/src/case/ReportSubmissionCard.vue @@ -105,6 +105,8 @@ import CasePrioritySelect from "@/case/priority/CasePrioritySelect.vue" import ProjectSelect from "@/project/ProjectSelect.vue" import DocumentApi from "@/document/api" import TagFilterAutoComplete from "@/tag/TagFilterAutoComplete.vue" +import SearchUtils from "@/search/utils" +import CaseTypeApi from "@/case/type/api" export default { setup() { @@ -224,7 +226,32 @@ export default { } if (this.$route.query.case_type) { - this.case_type = { name: this.$route.query.case_type } + let filterOptions = { + q: "", + sortBy: ["name"], + descending: [false], + itemsPerPage: this.numItems, + } + + if (this.project) { + filterOptions = { + filters: { + project: [this.project], + name: [this.$route.query.case_type], + enabled: ["true"], + }, + ...filterOptions, + } + } + + filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions }) + CaseTypeApi.getAll(filterOptions).then((response) => { + if (response.data.items.length > 0) { + this.case_type = response.data.items[0] + } else { + this.case_type = this.$route.query.case_type + } + }) } if (this.$route.query.case_priority) { diff --git a/src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue b/src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue index eebee8a357ac..08214efbc45f 100644 --- a/src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue +++ b/src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue @@ -105,7 +105,7 @@ export default { q: "", sortBy: ["name"], descending: [false], - itemsPerPage: this.numItems, + itemsPerPage: -1, } if (this.project) { @@ -120,9 +120,13 @@ export default { filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions }) + if (this.items.length == 0) { + CaseTypeApi.getAll(filterOptions).then((response) => { + this.items = response.data.items + }) + } + filterOptions.itemsPerPage = this.numItems CaseTypeApi.getAll(filterOptions).then((response) => { - this.items = response.data.items - this.total = response.data.total this.loading = false