From f404dd1e4d48d82f09ed08d384a90c64dd6d3021 Mon Sep 17 00:00:00 2001 From: Josh Traill Date: Fri, 20 Dec 2024 10:41:25 -0800 Subject: [PATCH 1/2] feat: court file search follow mockups refactor: script to composition api --- .../courtfilesearch/CourtFileSearchView.vue | 1037 +++++++---------- 1 file changed, 446 insertions(+), 591 deletions(-) diff --git a/web/src/components/courtfilesearch/CourtFileSearchView.vue b/web/src/components/courtfilesearch/CourtFileSearchView.vue index af484deb..7093cf2b 100644 --- a/web/src/components/courtfilesearch/CourtFileSearchView.vue +++ b/web/src/components/courtfilesearch/CourtFileSearchView.vue @@ -1,243 +1,189 @@ - - - + if (searchCriteria.givenName) { + queryParams['givenName'] = searchCriteria.givenName; + } + } else { + queryParams['searchMode'] = SearchModeEnum.PartName; + queryParams['orgName'] = searchCriteria.orgName; + } + + return queryParams; + }; + + const loadDataFromState = () => { + const search = courtFileSearchStore.currentSearchCriteria; + const results = courtFileSearchStore.currentSearchResults; + const selectedFilesFromStore = courtFileSearchStore.selectedFiles; + + if (search && results) { + searchResults.value = [...results]; + + const idSelector = searchCriteria.isCriminal + ? 'mdocJustinNo' + : 'physicalFileId'; + const files = searchResults.value.filter((c) => + selectedFilesFromStore.some((f) => f.key === c[idSelector]) + ); + selectedFiles.value = [...files]; + } + }; + + const viewFiles = (selectedFiles: KeyValueInfo[]) => { + courtFileSearchStore.addFilesForViewing({ + searchCriteria: searchCriteria, + searchResults: searchResults.value, + files: selectedFiles, + }); + const caseDetailUrl = `/${searchCriteria.isCriminal ? 'criminal-file' : 'civil-file'}/${selectedFiles[0].key}`; + router.push(caseDetailUrl); + }; + + const addSelectedFile = (file: FileDetail) => { + selectedFiles.value.push(file); + }; + + const removeSelectedFile = (idSelector: string, fileId: string) => { + selectedFiles.value = selectedFiles.value.filter( + (c) => c[idSelector] !== fileId + ); + }; + + const clearSelectedFiles = () => { + selectedFiles.value = []; + courtFileSearchStore.clearSelectedFiles(); + }; + const selectedDivision = ref('isCriminal'); + const showClassDropdown = computed(() => { + return selectedDivision.value === 'isCriminal'; + }); + From f7b22bfb7ec2b81af04c414b5c50df09b2319fe6 Mon Sep 17 00:00:00 2001 From: Josh Traill Date: Fri, 20 Dec 2024 10:53:51 -0800 Subject: [PATCH 2/2] refactor: whitespace --- web/src/components/courtfilesearch/CourtFileSearchView.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/components/courtfilesearch/CourtFileSearchView.vue b/web/src/components/courtfilesearch/CourtFileSearchView.vue index 7093cf2b..bf22e5e3 100644 --- a/web/src/components/courtfilesearch/CourtFileSearchView.vue +++ b/web/src/components/courtfilesearch/CourtFileSearchView.vue @@ -178,12 +178,12 @@