diff --git a/ppr-ui/package-lock.json b/ppr-ui/package-lock.json
index eedc675cd..83b8e1f57 100644
--- a/ppr-ui/package-lock.json
+++ b/ppr-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "ppr-ui",
- "version": "3.2.30",
+ "version": "3.2.31",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ppr-ui",
- "version": "3.2.30",
+ "version": "3.2.31",
"dependencies": {
"@bcrs-shared-components/input-field-date-picker": "^1.0.0",
"@lemoncode/fonk": "^1.5.1",
@@ -16263,4 +16263,4 @@
"dev": true
}
}
-}
\ No newline at end of file
+}
diff --git a/ppr-ui/package.json b/ppr-ui/package.json
index 69bd79d7f..4570e7885 100644
--- a/ppr-ui/package.json
+++ b/ppr-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
- "version": "3.2.30",
+ "version": "3.2.31",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
diff --git a/ppr-ui/src/components/common/SimpleTable.vue b/ppr-ui/src/components/common/SimpleTable.vue
index f08420810..e83472411 100644
--- a/ppr-ui/src/components/common/SimpleTable.vue
+++ b/ppr-ui/src/components/common/SimpleTable.vue
@@ -12,28 +12,135 @@
-
- {{ item.name }} |
-
+
+
+
+
+ {{ expandRow[rowIndex] ? 'mdi-chevron-up' : 'mdi-chevron-down' }}
+
+
+ {{ expandRow[rowIndex] ? 'Hide' : 'View' }} {{ rowLabel }}
+
+
+ {{ getItemValue(item, header.value) }}
+ |
+
+
+ |
+
+
+ |
+
+
diff --git a/ppr-ui/src/components/common/TabbedContainer.vue b/ppr-ui/src/components/common/TabbedContainer.vue
index 490152cbe..7af0be662 100644
--- a/ppr-ui/src/components/common/TabbedContainer.vue
+++ b/ppr-ui/src/components/common/TabbedContainer.vue
@@ -91,7 +91,4 @@ const tab = ref(0)
max-height: 55px;
margin: 0 2.5px;
}
-.v-window {
- min-height: 400px
-}
diff --git a/ppr-ui/src/components/mhrHistory/MhrHistoryDescription.vue b/ppr-ui/src/components/mhrHistory/MhrHistoryDescription.vue
new file mode 100644
index 000000000..7a88608e4
--- /dev/null
+++ b/ppr-ui/src/components/mhrHistory/MhrHistoryDescription.vue
@@ -0,0 +1,200 @@
+
+
+
+
+ Year of Manufacture
+
+
+ {{ content?.baseInformation?.year || '(Not Entered)' }}
+
+
+
+
+
+ CSA Number
+
+
+ {{ content?.csaNumber || '(Not Entered)' }}
+
+
+ CSA Standard
+
+
+ {{ content?.csaStandard || '(Not Entered)' }}
+
+
+
+
+
+ Engineer's Name
+
+
+ {{ content?.engineerName || '(Not Entered)' }}
+
+
+ Date of Engineer's Report
+
+
+ {{ shortPacificDate(content?.engineerDate) || '(Not Entered)' }}
+
+
+
+
+
+ Home Certification
+
+
+ {{ 'There is no certification available for this home.' }}
+
+
+
+
+
+ Home Sections
+
+
+
+
+
+
+ Rebuilt Status
+
+
+ {{ content?.rebuiltRemarks || '(Not Entered)' }}
+
+
+
+
+
+ Other Information
+
+
+ {{ content?.otherRemarks || '(Not Entered)' }}
+
+
+
+
+
+ Registration Date
+
+
+ {{ shortPacificDate(content?.createDateTime) || '(Not Entered)' }}
+
+
+ Document Type
+
+
+ {{ content?.registrationDescription || '(Not Entered)' }}
+
+
+ Registration Number
+
+
+ {{ content?.documentRegistrationNumber || '(Not Entered)' }}
+
+
+ Document ID
+
+
+ {{ content?.documentId || '(Not Entered)' }}
+
+
+
+
+
+
+
diff --git a/ppr-ui/src/components/mhrHistory/index.ts b/ppr-ui/src/components/mhrHistory/index.ts
new file mode 100644
index 000000000..3c76de619
--- /dev/null
+++ b/ppr-ui/src/components/mhrHistory/index.ts
@@ -0,0 +1 @@
+export { default as MhrHistoryDescription } from './MhrHistoryDescription.vue'
diff --git a/ppr-ui/src/interfaces/data-table-interfaces/table-headers-interface.ts b/ppr-ui/src/interfaces/data-table-interfaces/table-headers-interface.ts
index 0d507c9ed..6b03f9e9a 100644
--- a/ppr-ui/src/interfaces/data-table-interfaces/table-headers-interface.ts
+++ b/ppr-ui/src/interfaces/data-table-interfaces/table-headers-interface.ts
@@ -1,8 +1,9 @@
import { APISearchTypes } from '@/enums'
export interface BaseHeaderIF {
- text: string
- value: string
+ name?: string
+ text?: string
+ value: string|Array
class?: string
sortable?: boolean
width?: string
diff --git a/ppr-ui/src/interfaces/mhr-api-interfaces/MhrHistoryIF.ts b/ppr-ui/src/interfaces/mhr-api-interfaces/MhrHistoryIF.ts
index 26b38fc6b..6e178fb86 100644
--- a/ppr-ui/src/interfaces/mhr-api-interfaces/MhrHistoryIF.ts
+++ b/ppr-ui/src/interfaces/mhr-api-interfaces/MhrHistoryIF.ts
@@ -1,10 +1,12 @@
-interface Description {
+export interface DescriptionIF {
baseInformation?: {
circa?: boolean
make?: string
model?: string
year?: number
}
+ engineerName?: string
+ engineerDate?: string
createDateTime?: string
csaNumber?: string
csaStandard?: string
@@ -15,11 +17,11 @@ interface Description {
rebuiltRemarks?: string
registrationDescription?: string
sectionCount?: number
- sections?: Section[]
+ sections?: SectionIF[]
status?: string
}
-interface Section {
+export interface SectionIF {
lengthFeet?: number
lengthInches?: number
serialNumber?: string
@@ -27,7 +29,7 @@ interface Section {
widthInches?: number
}
-interface Address {
+export interface AddressIF {
city?: string
country?: string
postalCode?: string
@@ -35,8 +37,8 @@ interface Address {
street?: string
}
-interface Location {
- address?: Address
+export interface LocationIF {
+ address?: AddressIF
additionalDescription?: string
createDateTime?: string
documentId?: string
@@ -53,14 +55,14 @@ interface Location {
taxCertificate?: boolean
}
-interface IndividualName {
+export interface IndividualNameIF {
first?: string
last?: string
middle?: string
}
-interface Owner {
- address?: Address
+export interface OwnerIF {
+ address?: AddressIF
createDateTime?: string
documentId?: string
documentRegistrationNumber?: string
@@ -70,7 +72,7 @@ interface Owner {
groupId?: number
groupOwnerCount?: number
groupTenancyType?: string
- individualName?: IndividualName
+ individualName?: IndividualNameIF
interest?: string
interestDenominator?: number
interestNumerator?: number
@@ -82,7 +84,7 @@ interface Owner {
type?: string
}
-interface Registration {
+export interface RegistrationIF {
affirmByName?: string
attentionReference?: string
consideration?: string
@@ -96,10 +98,10 @@ interface Registration {
}
export interface MhrHistoryRoIF {
- descriptions?: Description[]
+ descriptions?: DescriptionIF[]
locations?: Location[]
mhrNumber: string
- owners?: Owner[]
- registrations?: Registration[]
+ owners?: OwnerIF[]
+ registrations?: RegistrationIF[]
statusType: string
}
diff --git a/ppr-ui/src/resources/mhr-history/mhHistoryTableHeaders.ts b/ppr-ui/src/resources/mhr-history/mhHistoryTableHeaders.ts
index d9ee43eb8..01b336b9e 100644
--- a/ppr-ui/src/resources/mhr-history/mhHistoryTableHeaders.ts
+++ b/ppr-ui/src/resources/mhr-history/mhHistoryTableHeaders.ts
@@ -1,32 +1,34 @@
-export const homeDescriptionHeaders = [
+import { BaseHeaderIF } from '@/interfaces'
+
+export const homeDescriptionHeaders: Array = [
{
name: '',
- value: 'action',
+ value: '',
class: 'column-width-md'
},
{
name: 'Manufacturer\'s Name',
- value: 'name',
- class: 'column-xs'
+ value: 'manufacturer',
+ class: 'col-22-5'
},
{
name: 'Make/Model',
- value: 'makeModel',
+ value: ['baseInformation.make', 'baseInformation.model'],
class: 'column-xs'
},
{
name: 'Serial Number',
- value: 'serial',
+ value: 'sections[0].serialNumber',
class: 'column-xs'
},
{
name: 'Registration Date',
- value: 'date',
+ value: 'createDateTime',
class: 'column-xs'
}
]
-export const homeLocationHeaders = [
+export const homeLocationHeaders: Array = [
{
name: '',
value: 'action',
@@ -35,7 +37,7 @@ export const homeLocationHeaders = [
{
name: 'Town/City',
value: 'townCity',
- class: 'column-xs'
+ class: 'col-22-5'
},
{
name: 'Street',
@@ -54,7 +56,7 @@ export const homeLocationHeaders = [
}
]
-export const homeOwnerHeaders = [
+export const homeOwnerHeaders: Array = [
{
name: '',
value: 'action',
@@ -63,7 +65,7 @@ export const homeOwnerHeaders = [
{
name: 'Owner Name',
value: 'name',
- class: 'column-xs'
+ class: 'col-22-5'
},
{
name: 'Tenancy Type',
diff --git a/ppr-ui/src/views/mhrInformation/MhrHistory.vue b/ppr-ui/src/views/mhrInformation/MhrHistory.vue
index 8a823adc4..aa0265f2e 100644
--- a/ppr-ui/src/views/mhrInformation/MhrHistory.vue
+++ b/ppr-ui/src/views/mhrInformation/MhrHistory.vue
@@ -40,18 +40,25 @@
>
+ :tableData="mhrHistory.descriptions"
+ >
+
+
+
+
@@ -99,6 +106,7 @@ import {
homeOwnerHeaders,
mhHistoryTabConfig
} from '@/resources/mhr-history'
+import { MhrHistoryDescription } from '@/components/mhrHistory'
/** Composables **/
const { isAuthenticated } = useAuth()
diff --git a/ppr-ui/tests/unit/SimpleTable.spec.ts b/ppr-ui/tests/unit/SimpleTable.spec.ts
index 2178ed82a..06b839c99 100644
--- a/ppr-ui/tests/unit/SimpleTable.spec.ts
+++ b/ppr-ui/tests/unit/SimpleTable.spec.ts
@@ -1,15 +1,30 @@
import { describe, it, expect, beforeEach } from 'vitest'
import { SimpleTable } from '@/components/common'
import { createComponent } from './utils'
+import { shortPacificDate } from '@/utils'
+import { nextTick } from 'vue'
const tableHeadersMock = [
- { name: 'Header 1', class: 'header-class-1' },
- { name: 'Header 2', class: 'header-class-2' },
+ { name: 'Header 1', class: 'header-class-1', value: 'name' },
+ { name: 'Header 2', class: 'header-class-2', value: 'name' },
+ { name: 'Header 3', class: 'header-class-3', value: 'dateField' },
+ { name: 'Header 4', class: 'header-class-4', value: 'sections[0].serialNumber' },
+ { name: 'Header 5', class: 'header-class-5', value: ['baseInformation.make', 'baseInformation.model'] }
]
const tableDataMock = [
- { name: 'Row 1' },
- { name: 'Row 2' },
+ {
+ name: 'Row 1',
+ dateField: '2024-01-01T00:00:00Z',
+ sections: [{ serialNumber: '12345' }],
+ baseInformation: { make: 'Make1', model: 'Model1' }
+ },
+ {
+ name: 'Row 2',
+ dateField: '2023-12-25T00:00:00Z',
+ sections: [{ serialNumber: '67890' }],
+ baseInformation: { make: 'Make2', model: 'Model2' }
+ }
]
describe('SimpleTable.vue', () => {
@@ -21,6 +36,7 @@ describe('SimpleTable.vue', () => {
tableData: tableDataMock,
})
})
+
it('renders correctly', () => {
expect(wrapper.exists()).toBe(true)
expect(wrapper.find('#simple-table').exists()).toBe(true)
@@ -39,9 +55,43 @@ describe('SimpleTable.vue', () => {
it('renders table data correctly', () => {
const rows = wrapper.findAll('tbody tr')
- expect(rows.length).toBe(tableDataMock.length)
+ expect(rows.length).toBe(tableDataMock.length) // considering expanded row
rows.forEach((row, index) => {
- expect(row.find('td').text()).toBe(tableDataMock[index].name)
+ if (index % 2 === 0) {
+ const dataIndex = index / 2
+ const cells = row.findAll('td')
+ expect(cells.at(1).text()).toBe(tableDataMock[dataIndex].name)
+ expect(cells.at(2).text()).toBe(shortPacificDate(tableDataMock[dataIndex].dateField))
+ expect(cells.at(3).text()).toBe(tableDataMock[dataIndex].sections[0].serialNumber)
+ expect(cells.at(4).text()).toBe(`${tableDataMock[dataIndex].baseInformation.make} ${tableDataMock[dataIndex].baseInformation.model}`)
+ }
})
})
+
+ it('toggles row expansion correctly', async () => {
+ const toggleBtn = await wrapper.findAll('.toggle-expand-row-btn')
+ toggleBtn.at(0).trigger('click')
+ await nextTick()
+
+ expect(wrapper.findAll('.content-slot-row').length).toBe(1)
+
+ toggleBtn.at(1).trigger('click')
+ await nextTick()
+
+ expect(wrapper.findAll('.content-slot-row').length).toBe(2)
+
+ toggleBtn.at(1).trigger('click')
+ await nextTick()
+
+ expect(wrapper.findAll('.content-slot-row').length).toBe(1)
+ })
+
+ it('getItemValue function works correctly', () => {
+ const { getItemValue } = wrapper.vm
+
+ expect(getItemValue(tableDataMock[0], 'name')).toBe('Row 1')
+ expect(getItemValue(tableDataMock[0], 'dateField')).toBe(shortPacificDate('2024-01-01T00:00:00Z'))
+ expect(getItemValue(tableDataMock[0], 'sections[0].serialNumber')).toBe('12345')
+ expect(getItemValue(tableDataMock[0], ['baseInformation.make', 'baseInformation.model'])).toBe('Make1 Model1')
+ })
})