Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealer Requirements Acceptance #2064

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.3.2",
"version": "3.3.3",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
8 changes: 3 additions & 5 deletions ppr-ui/src/components/userAccess/DealerInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ import { useUserAccess } from '@/composables'
import { storeToRefs } from 'pinia'
import { ref } from 'vue'

defineEmits(['confirmQsRequirements'])

const { getIsAccountAdministrator } = storeToRefs(useStore())
const { downloadServiceAgreement } = useUserAccess()

const activePanels = ref<number[]>([0])
const qsUserGuideUrl = 'https://www2.gov.bc.ca/assets/gov/employment-business-and-economic-development/' +
'business-management/permits-licences-and-registration/registries-other-assets/qs_transfers_sale_user_guide.pdf'

const acceptTerms = () => {
console.log('API PUT accepted agreement terms here')
}
</script>

<template>
Expand Down Expand Up @@ -173,7 +171,7 @@ const acceptTerms = () => {
<v-btn
class="mb-4 mt-4"
:ripple="false"
@click="acceptTerms"
@click="$emit('confirmQsRequirements')"
>
<span class="font-weight-bold">Confirm Account Updates</span>
</v-btn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export interface MhrQsPayloadIF {
dbaName?: string
address: AddressIF
phoneNumber: string
confirmRequirements?: boolean
}
23 changes: 17 additions & 6 deletions ppr-ui/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
</CautionBox>

<!-- Only Render for DEALERS who have NOT accepted the Updated Qualified Supplier Agreement Terms -->
<!-- // TODO: If DEALER that has NOT accepted Terms condition here -->
<DealerInfo
v-if="hasEnhancedDealerEnabled"
v-if="displayDealerInfo"
class="mt-0 mb-10"
@confirmQsRequirements="confirmQsRequirements"
/>

<!-- Search Selector -->
Expand Down Expand Up @@ -171,7 +171,7 @@ import { useRouter } from 'vue-router'
import { useStore } from '@/store/store'
import { storeToRefs } from 'pinia'
import { ProductStatus, RouteNames } from '@/enums'
import { getFeatureFlag, searchHistory } from '@/utils'
import { getFeatureFlag, getQualifiedSupplier, searchHistory, updateQualifiedSupplier } from '@/utils'
import { BaseSnackbar, CautionBox, RegistrationsWrapper } from '@/components/common'
import { DealerInfo } from '@/components/userAccess'
import { SearchHistory } from '@/components/tables'
Expand Down Expand Up @@ -248,6 +248,8 @@ export default defineComponent({
snackbarMsg: '',
toggleSnackbar: false,
toggleSearchAdded: false,
dealerRecord: null,
displayDealerInfo: false,
searchHistoryLength: computed((): number => {
return (getSearchHistory.value as SearchResponseIF[])?.length || 0
}),
Expand Down Expand Up @@ -356,10 +358,11 @@ export default defineComponent({
localState.loading = false
emitHaveData(true)

// Fetch and set account admin status
// TODO: If DEALER that has NOT accepted Terms condition here
if(hasEnhancedDealerEnabled.value) {
if (hasEnhancedDealerEnabled.value) {
// Fetch and set account admin status
await fetchIsAccountAdmin()
localState.dealerRecord = await getQualifiedSupplier()
localState.displayDealerInfo = !localState.dealerRecord?.confirmRequirements
}
}

Expand All @@ -373,6 +376,13 @@ export default defineComponent({
context.emit('haveData', haveData)
}

const confirmQsRequirements = async (): Promise<void> => {
localState.loading = true
await updateQualifiedSupplier({ ...localState.dealerRecord, confirmRequirements: true })
localState.displayDealerInfo = false
localState.loading = false
}

watch(() => props.appReady, (val: boolean) => {
onAppReady(val)
})
Expand Down Expand Up @@ -402,6 +412,7 @@ export default defineComponent({
setSearchDebtorName,
redirectRegistryHome,
retrieveSearchHistory,
confirmQsRequirements,
hasEnhancedDealerEnabled,
...toRefs(localState)
}
Expand Down
Loading