Skip to content

Commit

Permalink
Drs Mhr Table Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds committed Oct 18, 2024
1 parent 2eb8da3 commit 661517c
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 19 deletions.
8 changes: 6 additions & 2 deletions ppr-ui/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ VUE_APP_BCOL_STAFF_PARTY_CODE="99980001"
#vaults web-url
VUE_APP_REGISTRY_URL="https://dev.bcregistry.gov.bc.ca/dashboard"
VUE_APP_AUTH_WEB_URL="https://dev.account.bcregistry.gov.bc.ca/"
VUE_APP_DOCUMENTS_UI_URL="https://documents-ui-dev.firebaseapp.com"
VUE_APP_SITEMINDER_LOGOUT_URL="https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi"

#vaults API
Expand All @@ -21,12 +22,15 @@ VUE_APP_PPR_API_KEY=
VUE_APP_MHR_API_URL="https://bcregistry-dev.apigee.net/mhr"
VUE_APP_MHR_API_VERSION="/api/v1"
VUE_APP_MHR_API_KEY=
VUE_APP_DOC_API_URL="https://bcregistry-dev.apigee.net/doc"
VUE_APP_DOC_API_VERSION="/api/v1"
VUE_APP_DOC_API_KEY=""
VUE_APP_LTSA_API_URL="https://bcregistry-dev.apigee.net/ltsa"
VUE_APP_LTSA_API_VERSION="/api/v1"
VUE_APP_LTSA_API_KEY=
VUE_APP_AUTH_API_URL="https://auth-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_AUTH_API_URL="https://auth-api-dev-142173140222.northamerica-northeast1.run.app"
VUE_APP_AUTH_API_VERSION="/api/v1"
VUE_APP_STATUS_API_URL="https://status-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_STATUS_API_URL="https://status-api-dev.apps.gold.devops.gov.bc.ca/api/v1"
VUE_APP_STATUS_API_VERSION="/api/v1"
VUE_APP_PAY_API_URL="https://pay-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_PAY_API_VERSION="/api/v1"
Expand Down
4 changes: 2 additions & 2 deletions ppr-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ppr-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
"version": "3.2.65",
"version": "3.2.66",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
26 changes: 21 additions & 5 deletions ppr-ui/src/components/common/RegistrationsWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export default defineComponent({
getRegTableBaseRegs, getRegTableDraftsBaseReg, isMhrRegistration, isMhrManufacturerRegistration,
getRegTableTotalRowCount, getStateModel, getRegTableDraftsChildReg, hasMorePages, getRegTableNewItem,
getRegTableSortOptions, getRegTableSortPage, getUserSettings, getMhRegTableBaseRegs, isRoleStaffReg,
isRoleQualifiedSupplier, getRegTableMhSortOptions
isRoleQualifiedSupplier, getRegTableMhSortOptions, hasDrsEnabled
} = storeToRefs(useStore())
const {
Expand Down Expand Up @@ -399,11 +399,24 @@ export default defineComponent({
myRegActionDialog: dischargeConfirmationDialog as DialogOptionsIF,
myRegDataLoading: false,
myRegDataAdding: false,
myRegHeaders: props.isPpr ? [...registrationTableHeaders] : [...mhRegistrationTableHeaders],
myRegHeadersSelected: props.isPpr ? [...registrationTableHeaders] : [...mhRegistrationTableHeaders],
myRegHeaders: props.isPpr
? [...registrationTableHeaders]
: [...hasDrsEnabled.value
? mhRegistrationTableHeaders
: mhRegistrationTableHeaders.filter(item => item.value !== 'documentId')
],
myRegHeadersSelected: props.isPpr
? [...registrationTableHeaders]
: [...hasDrsEnabled.value
? mhRegistrationTableHeaders
: mhRegistrationTableHeaders.filter(item => item.value !== 'documentId')
],
myRegHeadersSelectable: props.isPpr
? [...registrationTableHeaders].slice(0, -1) // remove actions
: [...mhRegistrationTableHeaders].slice(0, -1), // remove actions
: [...hasDrsEnabled.value
? mhRegistrationTableHeaders
: mhRegistrationTableHeaders.filter(item => item.value !== 'documentId')
].slice(0, -1), // remove actions
myRegistrations: computed(() => {
if (props.isPpr && !!getRegTableDraftsBaseReg.value && !!getRegTableBaseRegs.value) {
return [...getRegTableDraftsBaseReg.value, ...getRegTableBaseRegs.value]
Expand Down Expand Up @@ -478,7 +491,10 @@ export default defineComponent({
localState.myRegHeadersSelected =
getUserSettings.value[SettingOptions.REGISTRATION_TABLE]?.mhrColumns?.length >= 1
? getUserSettings.value[SettingOptions.REGISTRATION_TABLE]?.mhrColumns
: [...mhRegistrationTableHeaders] // Default to all selections for initialization
: [...hasDrsEnabled.value
? mhRegistrationTableHeaders
: mhRegistrationTableHeaders.filter(item => item.value !== 'documentId')
] // Default to all selections for initialization
} else {
// set default headers
const headers = []
Expand Down
26 changes: 22 additions & 4 deletions ppr-ui/src/components/tables/RegistrationTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@
aria-hidden="true"
@click="showDatePicker = true"
/>
<v-text-field
v-if="!isPpr && header.value === 'documentId'"
v-model="documentId"
variant="filled"
color="primary"
singleLine
hideDetails="true"
type="text"
label="Document ID"
density="compact"
aria-hidden="true"
/>
<v-select
v-if="isPpr && header.value === 'statusType'"
v-model="status"
Expand Down Expand Up @@ -519,6 +531,7 @@ export default defineComponent({
// other table stuff
shouldClearType,
dateTxt,
documentId,
clearFilters
} = useRegistration(props.setSort)
const { sortDates } = useTableFeatures()
Expand Down Expand Up @@ -560,7 +573,7 @@ export default defineComponent({
tableFiltersActive: computed((): boolean => {
return !!(dateTxt.value || registrationNumber.value || registrationType.value ||
status.value || registeredBy.value || registeringParty.value ||
securedParties.value || folioNumber.value)
securedParties.value || folioNumber.value || documentId.value)
}),
tableHeadersWidth: computed(() => {
const width = tableHeaderRef?.value?.clientWidth || 0
Expand Down Expand Up @@ -766,8 +779,11 @@ export default defineComponent({
submittedStartDate.value,
submittedEndDate.value,
orderBy.value,
orderVal.value
], ([regParty, regType, regNum, folNum, secParty, regBy, status, startDate, endDate, orderBy, orderVal]) => {
orderVal.value,
documentId.value
], (
[regParty, regType, regNum, folNum, secParty, regBy, status, startDate, endDate, orderBy, orderVal, documentId]
) => {
// Close Date Picker on Sort
localState.showDatePicker = false
Expand All @@ -787,7 +803,8 @@ export default defineComponent({
regType: mapMhrDescriptionToCodes[regType] || regType,
secParty,
startDate,
status
status,
documentId
} as RegistrationSortIF,
sorting: localState.tableFiltersActive
})
Expand Down Expand Up @@ -831,6 +848,7 @@ export default defineComponent({
dateSortHandler,
datePicker,
dateTxt,
documentId,
emitError,
emitRowAction,
firstItem,
Expand Down
63 changes: 62 additions & 1 deletion ppr-ui/src/components/tables/common/TableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,48 @@
Not Registered
</span>
</td>

<!-- Conditional Document ID: Staff Only and Selected -->
<td
v-if="hasDrsEnabled && hasDrsEnabled && inSelectedHeaders('documentId')"
:class="isChild || item.expanded ? 'border-left': ''"
>
<span v-if="!isDraft(item) && isElegibleDocId(item?.documentId)">
<a
class="font-weight-regular"
:href="documentRecordUrl(item.documentId)"
target="_blank"
>
{{ item.documentId }}
<v-icon size="18">mdi-open-in-new</v-icon>
</a>
</span>
<span
v-else
class="font-weight-regular"
>
N/A
<v-tooltip
v-if="!isDraft(item)"
class="pa-2"
contentClass="top-tooltip"
location="top"
transition="fade-transition"
>
<template #activator="{ props }">
<v-icon
color="primary"
size="20"
v-bind="props"
>
mdi-information-outline
</v-icon>
</template>
Filing was created outside of MHR Registries therefore document ID is not applicable
</v-tooltip>
</span>
</td>
<td
v-if="inSelectedHeaders('statusType')"
:class="isChild || item.expanded ? 'border-left': ''"
Expand Down Expand Up @@ -731,7 +773,8 @@ export default defineComponent({
isRoleStaffSbc,
isRoleStaffBcol,
isRoleStaffReg,
getMhRegTableBaseRegs
getMhRegTableBaseRegs,
hasDrsEnabled
} = storeToRefs(useStore())
const {
Expand Down Expand Up @@ -791,6 +834,11 @@ export default defineComponent({
})
})
const documentRecordUrl = (documentId: string) => {
const configDocumentUrl = sessionStorage.getItem('DOCUMENTS_URL')
return `${configDocumentUrl}/document-records/${documentId}`
}
const hasRequiredTransfer = (item: MhRegistrationSummaryIF) => {
return !props.isPpr && !localState.isChild &&
item.statusType === MhApiStatusTypes.FROZEN &&
Expand Down Expand Up @@ -1024,6 +1072,16 @@ export default defineComponent({
: (item.statusType === MhApiStatusTypes.DRAFT || item.statusType === undefined || !item.mhrNumber)
}
/**
* Checks if the given document ID is elegibile, returns true if the document ID is eligible
* Rules:
* - Document ID to link out to record if one exists, otherwise show NA.
* - Ignore 8 digit long IDs that start with '1', '8', '9', or 'REG'.
*/
const isElegibleDocId = (docId: string): boolean => {
return docId && !(docId.length === 8 && /^[189]|REG/.test(docId));
}
const isExpired = (item: RegistrationSummaryIF): boolean => {
return item.statusType === APIStatusTypes.EXPIRED
}
Expand Down Expand Up @@ -1183,6 +1241,7 @@ export default defineComponent({
isActive,
isDischarged,
isDraft,
isElegibleDocId,
isExpired,
isRepairersLien,
isExemptOrCancelled,
Expand Down Expand Up @@ -1213,6 +1272,8 @@ export default defineComponent({
HomeLocationTypes,
isNonResExemptionEnabled,
MhApiStatusTypes,
documentRecordUrl,
hasDrsEnabled,
...toRefs(localState)
}
}
Expand Down
2 changes: 2 additions & 0 deletions ppr-ui/src/composables/useRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const useRegistration = (setSort: RegistrationSortIF) => {
registrationType: setSort?.regType || '',
status: setSort?.status || '',
registeredBy: setSort?.regBy || '',
documentId: setSort?.documentId || '',
registeringParty: setSort?.regParty || '',
securedParties: setSort?.secParty || '',
shouldClearType: false,
Expand Down Expand Up @@ -87,6 +88,7 @@ export const useRegistration = (setSort: RegistrationSortIF) => {
localState.registrationNumber = ''
localState.registrationType = null
localState.status = null
localState.documentId = ''
localState.registeredBy = ''
localState.registeringParty = ''
localState.securedParties = ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export interface RegistrationSortIF {
regType: string,
secParty: string,
startDate: string,
status: string
status: string,
documentId: string
}
7 changes: 7 additions & 0 deletions ppr-ui/src/resources/tableHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,13 @@ export const mhRegistrationTableHeaders: Array<BaseHeaderIF> = [
value: 'createDateTime',
display: true
},
{
class: 'column-mdl',
sortable: true,
text: 'Document ID',
value: 'documentId',
display: true
},
{
class: 'column-md',
sortable: true,
Expand Down
6 changes: 6 additions & 0 deletions ppr-ui/src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ export const useStore = defineStore('assetsStore', () => {
const hasMhrEnabled = computed<boolean>(() => {
return getUserProductSubscriptionsCodes.value.includes(ProductCode.MHR) && getFeatureFlag('mhr-ui-enabled')
})
const hasDrsEnabled = computed<boolean>(() => {
return isRoleStaffReg.value && getFeatureFlag('drs-integration-enabled')
})
const getUserServiceFee = computed<number>(() => {
return state.value.userInfo?.feeSettings?.serviceFee || 1.50
})
Expand Down Expand Up @@ -1552,6 +1555,9 @@ export const useStore = defineStore('assetsStore', () => {
hasPprEnabled,
hasMhrEnabled,

// Document Record Service
hasDrsEnabled,

// Add Collateral getters
getAddCollateral,
getOriginalAddCollateral,
Expand Down
8 changes: 8 additions & 0 deletions ppr-ui/src/utils/config-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export async function fetchConfig (): Promise<any> {
sessionStorage.setItem('MHR_API_URL', mhrApiUrl)
sessionStorage.setItem('MHR_API_KEY', mhrApiKey)

const docApiUrl: string = import.meta.env.VUE_APP_DOC_API_URL + import.meta.env.VUE_APP_DOC_API_VERSION + '/'
const docApiKey: string = import.meta.env.VUE_APP_DOC_API_KEY
sessionStorage.setItem('DOC_API_URL', docApiUrl)
sessionStorage.setItem('DOC_API_KEY', docApiKey)

const ltsaApiUrl: string = import.meta.env.VUE_APP_LTSA_API_URL + import.meta.env.VUE_APP_LTSA_API_VERSION + '/'
const ltsaApiKey: string = import.meta.env.VUE_APP_PPR_API_KEY
sessionStorage.setItem('LTSA_API_URL', ltsaApiUrl)
Expand All @@ -45,6 +50,9 @@ export async function fetchConfig (): Promise<any> {
const registryUrl: string = import.meta.env.VUE_APP_REGISTRY_URL
sessionStorage.setItem('REGISTRY_URL', registryUrl)

const documentsUrl: string = import.meta.env.VUE_APP_DOCUMENTS_UI_URL
sessionStorage.setItem('DOCUMENTS_URL', documentsUrl)

const vonApiUrl: string = import.meta.env.VUE_APP_VON_API_URL + import.meta.env.VUE_APP_VON_API_VERSION
sessionStorage.setItem('VON_API_URL', vonApiUrl)

Expand Down
1 change: 1 addition & 0 deletions ppr-ui/src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const defaultFlagSet: LDFlagSet = {
'mhr-cancel-transport-permit-enabled': false,
'mhr-user-access-enabled': false,
'mhr-history-enabled': false,
'drs-integration-enabled': false, // Enables connections to Documents Record Services
'sentry-enable': false, // by default, no sentry logs
'banner-text': '' // by default, there is no banner text
}
Expand Down
3 changes: 2 additions & 1 deletion ppr-ui/src/utils/mhr-api-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,8 @@ const UIFilterToApiFilter = {
regType: 'registrationType',
startDate: 'startDateTime',
status: 'statusType',
regParty: 'submittingName'
regParty: 'submittingName',
documentId: 'documentId'
}

// add sorting params for registration history/draft api calls
Expand Down
6 changes: 4 additions & 2 deletions ppr-ui/tests/unit/RegistrationsWrapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { nextTick } from 'vue'
import { RegistrationsWrapper } from '@/components/common'
import { RegistrationTable } from '@/components/tables'
import { SettingOptions, TableActions } from '@/enums'
import { AuthRoles, SettingOptions, TableActions } from '@/enums'
import {
DraftResultIF,
MhrDraftIF,
Expand All @@ -25,7 +25,7 @@ import { createComponent } from './utils'
import { useStore } from '@/store/store'
import flushPromises from 'flush-promises'
import { afterAll, vi } from 'vitest'
import { mhrRegistrationHistory } from '@/utils'
import { defaultFlagSet, mhrRegistrationHistory } from '@/utils'

const store = useStore()

Expand Down Expand Up @@ -294,10 +294,12 @@ describe('MHR registration table tests', () => {
}))

beforeEach(async () => {
defaultFlagSet['drs-integration-enabled'] = true
// set base selected columns
await store.setUserInfo(
{ settings: { [SettingOptions.REGISTRATION_TABLE]: { columns: mhRegistrationTableHeaders } } }
)
await store.setAuthRoles([AuthRoles.PPR_STAFF])
wrapper = await createComponent(RegistrationsWrapper, { appReady: true, isMhr: true })
await flushPromises()
await nextTick()
Expand Down

0 comments on commit 661517c

Please sign in to comment.