diff --git a/ppr-ui/package-lock.json b/ppr-ui/package-lock.json index 532f8d264..27b18b9ff 100644 --- a/ppr-ui/package-lock.json +++ b/ppr-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "ppr-ui", - "version": "3.2.71", + "version": "3.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ppr-ui", - "version": "3.2.71", + "version": "3.3.0", "dependencies": { "@bcrs-shared-components/input-field-date-picker": "^1.0.0", "@lemoncode/fonk": "^1.5.1", diff --git a/ppr-ui/package.json b/ppr-ui/package.json index 01ddbacd8..31bc58638 100644 --- a/ppr-ui/package.json +++ b/ppr-ui/package.json @@ -1,15 +1,17 @@ { "name": "ppr-ui", - "version": "3.2.71", + "version": "3.3.0", "private": true, "appName": "Assets UI", "sbcName": "SBC Common Components", "scripts": { "dev": "vite dev", "build": "vite build", + "build-check": "vite build", "preview": "vite preview --port 8080", "lint": "eslint . --ext .js,.ts,.vue", "lint:fix": "eslint . --ext .js,.ts,.vue --fix", + "test": "vitest run", "test:unit": "vitest run", "test:coverage": "vitest run --coverage" }, diff --git a/ppr-ui/src/components/userAccess/DealerInfo.vue b/ppr-ui/src/components/userAccess/DealerInfo.vue new file mode 100644 index 000000000..563671102 --- /dev/null +++ b/ppr-ui/src/components/userAccess/DealerInfo.vue @@ -0,0 +1,137 @@ + + + + diff --git a/ppr-ui/src/components/userAccess/index.ts b/ppr-ui/src/components/userAccess/index.ts index 39f0f034c..626e01c21 100644 --- a/ppr-ui/src/components/userAccess/index.ts +++ b/ppr-ui/src/components/userAccess/index.ts @@ -1 +1,2 @@ export { default as ServiceAgreement } from './ServiceAgreement.vue' +export { default as DealerInfo } from './DealerInfo.vue' diff --git a/ppr-ui/src/composables/userAccess/useUserAccess.ts b/ppr-ui/src/composables/userAccess/useUserAccess.ts index 65ef1fa74..4cafd2da9 100644 --- a/ppr-ui/src/composables/userAccess/useUserAccess.ts +++ b/ppr-ui/src/composables/userAccess/useUserAccess.ts @@ -6,6 +6,7 @@ import { createQualifiedSupplier, fromDisplayPhone, getAccountInfoFromAuth, + getAccountMembers, getFeatureFlag, getKeyByValue, getMhrManufacturerInfo, @@ -20,6 +21,7 @@ import { updateUserSettings } from '@/utils' import { + AccountProductMemberships, ApiHomeTenancyTypes, HomeLocationTypes, HomeOwnerPartyTypes, @@ -53,7 +55,8 @@ export const useUserAccess = () => { setMhrQsSubmittingParty, setMhrQsAuthorization, setMhrQsIsRequirementsConfirmed, - setMhrQsValidation + setMhrQsValidation, + setIsAccountAdministrator } = useStore() const { getAccountId, @@ -194,6 +197,15 @@ export const useUserAccess = () => { ) }) + /** Returns True if the current user is an Account Admin **/ + const fetchIsAccountAdmin = async (): Promise => { + const { members } = await getAccountMembers() + const isAdmin = members?.some(member => member.membershipTypeCode === AccountProductMemberships.ADMIN && + member.user && member.user.id === getCurrentUser.value.id + ) + setIsAccountAdministrator(isAdmin) + } + /** Navigate to User Access Home route **/ const goToUserAccess = async (): Promise => { if (!hasPendingQsAccess.value && !isUserAccessRoute.value) { @@ -507,6 +519,7 @@ export const useUserAccess = () => { setQsInformationModel, setQsDefaultValidation, updateUserMiscSettings, + fetchIsAccountAdmin, isQsAccessEnabled, hasPendingQsAccess, hasRejectedQsAccess, diff --git a/ppr-ui/src/interfaces/account-interfaces/account-info-interface.ts b/ppr-ui/src/interfaces/account-interfaces/account-info-interface.ts index 764a92360..0d7ba3042 100644 --- a/ppr-ui/src/interfaces/account-interfaces/account-info-interface.ts +++ b/ppr-ui/src/interfaces/account-interfaces/account-info-interface.ts @@ -14,4 +14,6 @@ export interface AccountInfoIF { name: string // account name or business name mailingAddress: AddressIF accountAdmin: AccountAdminInfoIF + phoneNumber?: string + phoneExtension?: string } diff --git a/ppr-ui/src/interfaces/store-interfaces/state-interfaces/user-info-interface.ts b/ppr-ui/src/interfaces/store-interfaces/state-interfaces/user-info-interface.ts index 81113f655..a974a8043 100644 --- a/ppr-ui/src/interfaces/store-interfaces/state-interfaces/user-info-interface.ts +++ b/ppr-ui/src/interfaces/store-interfaces/state-interfaces/user-info-interface.ts @@ -2,6 +2,7 @@ import { ContactInfoIF, FeeSettingsIF, UserSettingsIF } from '.' // User Info state model export interface UserInfoIF { + id?: string contacts: Array feeSettings: FeeSettingsIF firstname: string diff --git a/ppr-ui/src/interfaces/store-interfaces/state-model-interface.ts b/ppr-ui/src/interfaces/store-interfaces/state-model-interface.ts index d72e64a9c..c13be996b 100644 --- a/ppr-ui/src/interfaces/store-interfaces/state-model-interface.ts +++ b/ppr-ui/src/interfaces/store-interfaces/state-model-interface.ts @@ -41,6 +41,7 @@ import { UnitNoteIF } from '@/interfaces/unit-note-interfaces/unit-note-interfac // State model example export interface StateModelIF { accountInformation: AccountInformationIF + isAccountAdministrator: boolean accountProductSubscriptions: AccountProductSubscriptionIF userProductSubscriptions: Array userProductSubscriptionsCodes: Array diff --git a/ppr-ui/src/resources/mhrSubProductConfig.ts b/ppr-ui/src/resources/mhrSubProductConfig.ts index cac25484e..187f2ab3e 100644 --- a/ppr-ui/src/resources/mhrSubProductConfig.ts +++ b/ppr-ui/src/resources/mhrSubProductConfig.ts @@ -11,8 +11,8 @@ export const MhrSubProductConfig: Array = [ ], hasImportantBullet: false, /* eslint-disable max-len */ - note: `General Service Providers who are not lawyers or notaries cannot request Qualified Supplier access online - and must submit a paper application to BC Registries.` /* eslint-enable max-len */ }, @@ -29,7 +29,7 @@ export const MhrSubProductConfig: Array = [ type: MhrSubTypes.DEALERS, label: `${MhrSubTypes.QUALIFIED_SUPPLIER} - ${MhrSubTypes.DEALERS}`, productBullets: [ - MhrActions.MHR_SEARCH, MhrActions.TRANSPORT_PERMITS_NO_CERT + MhrActions.MHR_SEARCH, MhrActions.TRANSPORT_PERMITS_NO_CERT, MhrActions.TRANSFER_TRANSACTIONS ], hasImportantBullet: false } diff --git a/ppr-ui/src/resources/userAccessRequirements.ts b/ppr-ui/src/resources/userAccessRequirements.ts index fec8f9d9b..f3005ad35 100644 --- a/ppr-ui/src/resources/userAccessRequirements.ts +++ b/ppr-ui/src/resources/userAccessRequirements.ts @@ -23,6 +23,12 @@ export const userAccessRequirements: Record { boldText: 'Have comprehensive general liability insurance ', regularText: 'equal to or greater than $2,000,000.00.' + }, + { + boldText: 'All filed documents will be stored for 7 years. ', + regularText: 'If requested, a copy or certified copy of filed documents ' + + '(such as the Bill of Sale, or other signed forms), ' + + 'will be provided within 7 business days, at the fee level set by the Registrar.' } ], [MhrSubTypes.GENERAL_PUBLIC]: [], diff --git a/ppr-ui/src/store/state/state-model.ts b/ppr-ui/src/store/state/state-model.ts index f18cc26c0..2d216a623 100644 --- a/ppr-ui/src/store/state/state-model.ts +++ b/ppr-ui/src/store/state/state-model.ts @@ -8,6 +8,7 @@ export const stateModel: StateModelIF = { label: '', type: '' }, + isAccountAdministrator: false, accountProductSubscriptions: null, userProductSubscriptions: [], userProductSubscriptionsCodes: [], diff --git a/ppr-ui/src/store/store.ts b/ppr-ui/src/store/store.ts index 22f87d92d..3838790c1 100644 --- a/ppr-ui/src/store/store.ts +++ b/ppr-ui/src/store/store.ts @@ -104,6 +104,9 @@ export const useStore = defineStore('assetsStore', () => { const getAccountModel = computed((): AccountModelIF => { return null // account }) + const getIsAccountAdministrator = computed((): boolean => { + return state.value.isAccountAdministrator + }) const isRoleStaffSbc = computed((): boolean => { return state.value.authorization?.isSbc }) @@ -338,6 +341,9 @@ export const useStore = defineStore('assetsStore', () => { const hasDrsEnabled = computed(() => { return isRoleStaffReg.value && getFeatureFlag('drs-integration-enabled') }) + const hasEnhancedDealerEnabled = computed(() => { + return isRoleQualifiedSupplierHomeDealer.value && getFeatureFlag('mhr-enhanced-dealers-enabled') + }) const getUserServiceFee = computed(() => { return state.value.userInfo?.feeSettings?.serviceFee || 1.50 }) @@ -376,7 +382,7 @@ export const useStore = defineStore('assetsStore', () => { const getIsStaffClientPayment = computed(() => { return state.value.isStaffClientPayment }) - const getMhrGenerateDocId = computed(() => { + const getMhrGenerateDocId = computed(() => { return state.value.generateDocId }) const showStepErrors = computed(() => { @@ -989,6 +995,10 @@ export const useStore = defineStore('assetsStore', () => { state.value.accountInformation = accountInformation } + function setIsAccountAdministrator (isAdmin: boolean) { + state.value.isAccountAdministrator = isAdmin + } + function setAddCollateral (addCollateral: AddCollateralIF) { state.value.registration.collateral = addCollateral setUnsavedChanges(true) @@ -1531,6 +1541,7 @@ export const useStore = defineStore('assetsStore', () => { return { // User-related getters getAccountModel, + getIsAccountAdministrator, getCurrentUser, getUserEmail, getUserFirstName, @@ -1565,10 +1576,10 @@ export const useStore = defineStore('assetsStore', () => { hasPprEnabled, hasMhrEnabled, hasMhrReIssuePermitEnabled, + hasEnhancedDealerEnabled, // Document Record Service hasDrsEnabled, - // Add Collateral getters getAddCollateral, getOriginalAddCollateral, @@ -1749,6 +1760,7 @@ export const useStore = defineStore('assetsStore', () => { setUserProductSubscriptions, setUserProductSubscriptionsCodes, setAccountInformation, + setIsAccountAdministrator, setAddCollateral, setOriginalAddCollateral, setAddSecuredPartiesAndDebtors, diff --git a/ppr-ui/src/utils/auth-helper.ts b/ppr-ui/src/utils/auth-helper.ts index 61e621ed2..16d211d66 100644 --- a/ppr-ui/src/utils/auth-helper.ts +++ b/ppr-ui/src/utils/auth-helper.ts @@ -217,6 +217,31 @@ export async function getSbcFromAuth (): Promise { ) } +/** Get Org Members from auth api **/ +export async function getAccountMembers (): Promise { + const url = sessionStorage.getItem('AUTH_API_URL') + const currentAccount = sessionStorage.getItem(SessionStorageKeys.CurrentAccount) + const accountInfo = JSON.parse(currentAccount) + const accountId = accountInfo?.id + + const config = { baseURL: url, headers: { Accept: 'application/json' } } + return axios.get(`orgs/${accountId}/members?active`, config) + .then( + response => { + const data = response?.data + if (!data) { + return false + } + return data + } + ).catch( + error => { + throw new Error('Auth API error getting SBC: status code = ' + + error?.response?.status?.toString() || StatusCodes.NOT_FOUND.toString()) + } + ) +} + /** * Fetches product subscription authorizations from Auth API. */ diff --git a/ppr-ui/src/utils/feature-flags.ts b/ppr-ui/src/utils/feature-flags.ts index b44b51135..8ebe39c86 100644 --- a/ppr-ui/src/utils/feature-flags.ts +++ b/ppr-ui/src/utils/feature-flags.ts @@ -23,7 +23,8 @@ export const defaultFlagSet: LDFlagSet = { 'mhr-user-access-enabled': false, 'mhr-history-enabled': false, 'mhr-re-issue-permit-enabled': false, // Enables Create New and Extend Transport Permit: Staff Targeted for now - 'drs-integration-enabled': false, // Enables connections to Documents Record Services + 'drs-integration-enabled': false, // Enables connections to Documents Record + 'mhr-enhanced-dealers-enabled': false, // Enables Dealer permissions for MHR Permits and Transfers 'sentry-enable': false, // by default, no sentry logs 'banner-text': '' // by default, there is no banner text } diff --git a/ppr-ui/src/views/Dashboard.vue b/ppr-ui/src/views/Dashboard.vue index 9e35f8368..0c7ef5378 100644 --- a/ppr-ui/src/views/Dashboard.vue +++ b/ppr-ui/src/views/Dashboard.vue @@ -62,6 +62,13 @@ + + + +
{ return !isRoleStaffSbc.value && getFeatureFlag('mhr-transfer-enabled') }), - isDraft: computed((): boolean => { + isDraft: computed((): string => { return getMhrInformation.value.draftNumber }), exemptDate: computed((): string => @@ -1117,6 +1118,7 @@ export default defineComponent({ localState.disableRoleBaseLocationChange = await disableDealerManufacturerLocationChange() break case isRoleQualifiedSupplierHomeDealer.value: + if (hasEnhancedDealerEnabled.value) break localState.disableRoleBaseTransfer = await disableDealerManufacturerTransfer(true) localState.disableRoleBaseLocationChange = await disableDealerManufacturerLocationChange(true) break diff --git a/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue b/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue index 11d938bc1..3d6ac4170 100644 --- a/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue +++ b/ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue @@ -67,7 +67,7 @@