diff --git a/ppr-ui/package-lock.json b/ppr-ui/package-lock.json index 203041b91..6171f4a12 100644 --- a/ppr-ui/package-lock.json +++ b/ppr-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "ppr-ui", - "version": "3.3.2", + "version": "3.3.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ppr-ui", - "version": "3.3.2", + "version": "3.3.3", "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 ead52fea1..b25ca8e68 100644 --- a/ppr-ui/package.json +++ b/ppr-ui/package.json @@ -1,6 +1,6 @@ { "name": "ppr-ui", - "version": "3.3.2", + "version": "3.3.3", "private": true, "appName": "Assets UI", "sbcName": "SBC Common Components", diff --git a/ppr-ui/src/components/userAccess/DealerInfo.vue b/ppr-ui/src/components/userAccess/DealerInfo.vue index bcc9aa137..6b0f9a296 100644 --- a/ppr-ui/src/components/userAccess/DealerInfo.vue +++ b/ppr-ui/src/components/userAccess/DealerInfo.vue @@ -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> @@ -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> diff --git a/ppr-ui/src/interfaces/mhr-user-access-interfaces/MhrQsPayloadIF.ts b/ppr-ui/src/interfaces/mhr-user-access-interfaces/MhrQsPayloadIF.ts index f622d8cae..eba18c709 100644 --- a/ppr-ui/src/interfaces/mhr-user-access-interfaces/MhrQsPayloadIF.ts +++ b/ppr-ui/src/interfaces/mhr-user-access-interfaces/MhrQsPayloadIF.ts @@ -7,4 +7,5 @@ export interface MhrQsPayloadIF { dbaName?: string address: AddressIF phoneNumber: string + confirmRequirements?: boolean } diff --git a/ppr-ui/src/views/Dashboard.vue b/ppr-ui/src/views/Dashboard.vue index 0c7ef5378..db4df2b4c 100644 --- a/ppr-ui/src/views/Dashboard.vue +++ b/ppr-ui/src/views/Dashboard.vue @@ -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 --> @@ -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' @@ -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 }), @@ -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 } } @@ -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) }) @@ -402,6 +412,7 @@ export default defineComponent({ setSearchDebtorName, redirectRegistryHome, retrieveSearchHistory, + confirmQsRequirements, hasEnhancedDealerEnabled, ...toRefs(localState) }