Skip to content

Commit

Permalink
21983 - Enhance Staff Review Table (#2928)
Browse files Browse the repository at this point in the history
Signed-off-by: Qin <[email protected]>
  • Loading branch information
ArwenQin authored Jul 24, 2024
1 parent 75f1747 commit 5a7a3d0
Show file tree
Hide file tree
Showing 8 changed files with 350 additions and 163 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,30 @@
</header>

<!-- Table Contents -->
<ContinuationApplicationTable />
<ContinuationApplicationTable
:reviewSessionStorageKey="reviewSessionStorageKey"
:reviewPaginationNumberOfItemsKey="reviewPaginationNumberOfItemsKey"
:reviewPaginationOptionsKey="reviewPaginationOptionsKey"
/>
</v-container>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import ContinuationApplicationTable from './ContinuationApplicationTable.vue'
import { SessionStorageKeys } from '@/util/constants'
import { defineComponent } from '@vue/composition-api'
@Component({
export default defineComponent({
name: 'ContinuationApplications',
components: {
ContinuationApplicationTable
},
data () {
return {
reviewSessionStorageKey: SessionStorageKeys.ReviewSearchFilter,
reviewPaginationNumberOfItemsKey: SessionStorageKeys.ReviewPaginationNumberOfItems,
reviewPaginationOptionsKey: SessionStorageKeys.ReviewPaginationOptions
}
}
})
export default class ContinuationApplications extends Vue {}
</script>
4 changes: 3 additions & 1 deletion auth-web/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,7 @@
"govnAccountDescription": "Service BC Staff will manually review your account information.",
"govnConfirmText": "BC Registry Staff will manually review the account to verify the account user. <b>Account will be rejected if account admin does not verify as a government other than BC provincial. </b>This is a option for townships, cities, districts, municipalities, and federal government.",
"searchAccountNoResult": "<h4>No Results</h4><p>None of the accounts matched this search. Try another search.</p>",
"searchAccountStartMessage": "Search accounts by entering one of the values above."
"searchAccountStartMessage": "Search accounts by entering one of the values above.",
"searchReviewsNoResult": "<h4>No Results</h4><p>None of the reviews matched this search. Try another search.</p>",
"searchReviewStartMessage": "Search reviews by entering one of the values above."
}
22 changes: 22 additions & 0 deletions auth-web/src/models/continuation-review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,25 @@ export interface ContinuationFilingIF {
status: any // we don't care about this
}
}

/** The Continuation Review search and sort params. */
export interface ReviewFilterParams {
submissionDate?: string
page?: number
limit?: number
nrNumber?: string
identifier?: string
completingParty?: string
decisionMadeBy?: string
status?: []
sortBy?: string
sortDesc?: boolean
}

/** The Continuation Review API returns search results. */
export interface ReviewList {
reviews: ContinuationReviewIF[]
limit: number
page: number
total: number
}
59 changes: 22 additions & 37 deletions auth-web/src/services/business.services.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BNRequest, ResubmitBNRequest } from '@/models/request-tracker'
import { Business, BusinessRequest, FolioNumberload, PasscodeResetLoad } from '@/models/business'
import { ContinuationReviewIF, ReviewStatus } from '@/models/continuation-review'
import { ContinuationReviewIF, ReviewFilterParams, ReviewStatus } from '@/models/continuation-review'
import { AxiosResponse } from 'axios'
import CommonUtils from '@/util/common-util'
import ConfigHelper from '@/util/config-helper'
Expand Down Expand Up @@ -202,41 +202,26 @@ export default class BusinessService {
})
}

// *** TODO: this should return type "array of reviews"
static async fetchContinuationReviews (): Promise<any> {
// Mock data simulating the expected response structure from the API
await new Promise(resolve => setTimeout(resolve, 1000))
return new Promise(resolve => resolve({
data: [
{
reviewId: 1,
date: 'July 3, 2024',
nrNumber: 'NR 0001234',
businessIdentifier: 'LN958001',
completingParty: 'John Doe',
status: 'Approved'
},
{
reviewId: 2,
date: 'April 4, 2024',
nrNumber: 'NR 0001235',
businessIdentifier: 'LN786002',
completingParty: 'Jane Smith',
status: 'Resubmitted'
},
{
reviewId: 3,
date: 'June 15, 2024',
nrNumber: 'NR 0001239',
businessIdentifier: 'LN965002',
completingParty: 'Test Mark',
status: 'Awaiting Review'
}
]
} as any))

// const url = `${ConfigHelper.getLegalAPIV2Url()}/reviews/continuation-in`
// const response = await axios.get(url)
// return response.data
static async searchReviews (reviewFilter: ReviewFilterParams) {
const params = new URLSearchParams()
for (const key in reviewFilter) {
const value = reviewFilter[key]
if (Array.isArray(value)) {
// for status, which is an array
value.forEach(item => params.append(key, item))
} else {
params.append(key, value)
}
}
try {
const response = await axios.get(`${ConfigHelper.getLegalAPIV2Url()}/admin/reviews`, { params })
if (response?.data) {
return response.data
}
return null
} catch (error) {
console.error('Error fetching reviews:', error)
return null
}
}
}
3 changes: 3 additions & 0 deletions auth-web/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ export enum SessionStorageKeys {
SessionSynced = 'SESSION_SYNCED',
InvitationToken = 'INV_TOKEN',
PaginationOptions = 'PAGINATION_OPTIONS',
ReviewPaginationOptions = 'REVIEW_PAGINATION_OPTIONS',
InactivePaginationOptions = 'INACTIVE_PAGINATION_OPTIONS',
PaginationNumberOfItems = 'PAGINATION_NUMBER_OF_ITEMS',
ReviewPaginationNumberOfItems = 'REVIEW_PAGINATION_NUMBER_OF_ITEMS',
InactivePaginationNumberOfItems = 'INACTIVE_PAGINATION_NUMBER_OF_ITEMS',
OrgSearchFilter = 'ORG_SEARCH_FILTER',
ReviewSearchFilter = 'REV_SEARCH_FILTER',
InactiveSearchFilter = 'INACTIVE_SEARCH_FILTER',
ShortNamesSummaryFilter = 'SHORT_NAMES_SUMMARY_FILTER',
LinkedShortNamesFilter = 'LINKED_SHORT_NAMES_FILTER',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { createLocalVue, mount } from '@vue/test-utils'
import ContinuationApplicationTable from '@/components/auth/staff/continuation-application/ContinuationApplicationTable.vue'
import Vue from 'vue'
import VueRouter from 'vue-router'
import Vuetify from 'vuetify'
import initialize from '@/plugins/i18n'

const vuetify = new Vuetify({})
const router = new VueRouter()
const i18n = initialize(Vue)

describe('StaffContinuationApplicationTable.vue', () => {
let wrapper: any
Expand All @@ -17,6 +20,7 @@ describe('StaffContinuationApplicationTable.vue', () => {
vuetify,
localVue,
router,
i18n,

mocks: {
$t: (mock) => mock
Expand All @@ -28,84 +32,7 @@ describe('StaffContinuationApplicationTable.vue', () => {
wrapper.destroy()
})

it('is a Vue instance', () => {
expect(wrapper.vm).toBeTruthy()
})

it('Should have data table', () => {
expect(wrapper.find('.v-data-table')).toBeTruthy()
})

it('Should render correct button labels', async () => {
wrapper.setData({
reviews: [
{
reviewId: '123',
status: 'Awaiting Review',
date: '2024-05-01',
nrNumber: 'NR 1234567',
businessIdentifier: 'LN987234',
completingParty: 'James Smith'
},
{
reviewId: '124',
status: 'Approved',
date: '2024-05-01',
nrNumber: 'NR 1234568',
businessIdentifier: 'LN987235',
completingParty: 'John Doe'
}
]
})

await wrapper.vm.$nextTick()

const reviewButton = wrapper.find(`[data-test="view-continuation-button-123"]`)
const viewButton = wrapper.find(`[data-test="view-continuation-button-124"]`)

expect(reviewButton.text()).toBe('Review')
expect(viewButton.text()).toBe('View')
})

it('should fetch and render data correctly', async () => {
wrapper.setData({
reviews: [
{
reviewId: '123',
status: 'Awaiting Review',
date: '2024-05-01',
nrNumber: 'NR 1234567',
businessIdentifier: 'LN987234',
completingParty: 'James Smith'
},
{
reviewId: '124',
status: 'Approved',
date: '2024-05-02',
nrNumber: 'NR 1234568',
businessIdentifier: 'LN987235',
completingParty: 'John Doe'
}
]
})

await wrapper.vm.$nextTick()

const rows = wrapper.findAll('tbody tr')
expect(rows.length).toBe(2)

const firstRowColumns = rows.at(0).findAll('td')
expect(firstRowColumns.at(0).text()).toBe('2024-05-01')
expect(firstRowColumns.at(1).text()).toBe('NR 1234567')
expect(firstRowColumns.at(2).text()).toBe('LN987234')
expect(firstRowColumns.at(3).text()).toBe('James Smith')
expect(firstRowColumns.at(4).text()).toBe('Awaiting Review')

const secondRowColumns = rows.at(1).findAll('td')
expect(secondRowColumns.at(0).text()).toBe('2024-05-02')
expect(secondRowColumns.at(1).text()).toBe('NR 1234568')
expect(secondRowColumns.at(2).text()).toBe('LN987235')
expect(secondRowColumns.at(3).text()).toBe('John Doe')
expect(secondRowColumns.at(4).text()).toBe('Approved')
})
})
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Wrapper, createLocalVue, mount } from '@vue/test-utils'
import { useCodesStore, useOrgStore, useStaffStore, useTaskStore, useUserStore } from '@/stores'
import { BaseVExpansionPanel } from '@/components'
import ContinuationApplications from '@/components/auth/staff/continuation-application/ContinuationApplications.vue'
import GLCodesListView from '@/views/auth/staff/GLCodesListView.vue'
import IncorporationSearchResultView from '@/views/auth/staff/IncorporationSearchResultView.vue'
import { MembershipType } from '@/models/Organization'
Expand Down Expand Up @@ -49,7 +50,7 @@ describe('StaffDashboardView tests', () => {
wrapper = mount(StaffDashboardView, {
localVue,
vuetify,
stubs: ['Transactions', 'StaffAccountManagement', 'PPRLauncher', 'GLCodesListView']
stubs: ['Transactions', 'StaffAccountManagement', 'ContinuationApplications', 'PPRLauncher', 'GLCodesListView']
})
})

Expand All @@ -63,6 +64,7 @@ describe('StaffDashboardView tests', () => {
expect(wrapper.findComponent(PPRLauncher).exists()).toBe(true)
expect(wrapper.findComponent(IncorporationSearchResultView).exists()).toBe(true)
expect(wrapper.findComponent(StaffAccountManagement).exists()).toBe(true)
expect(wrapper.findComponent(ContinuationApplications).exists()).toBe(true)
expect(wrapper.find('#EFT-button').exists())
expect(wrapper.find('#involuntary-dissolution-button').exists())
const expansionPanels = wrapper.findAll(BaseVExpansionPanel)
Expand Down

0 comments on commit 5a7a3d0

Please sign in to comment.