Skip to content

Commit

Permalink
Ongoing DocID Work
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds committed Oct 22, 2024
1 parent 9a0f8ea commit 26e2cd1
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 89 deletions.
65 changes: 57 additions & 8 deletions ppr-ui/src/components/common/DocumentId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@
color="primary"
maxlength="8"
label="Document ID Number"
:disabled="generateDocumentId"
:rules="documentIdRules"
:error="!isUniqueDocId && validate"
:error="!isUniqueDocId && validate && !generateDocumentId"
:errorMessages="uniqueDocIdError"
:hint="content.hintText"
:persistentHint="Boolean(content.hintText)"
Expand All @@ -59,13 +60,44 @@
:width="3"
/>
<v-icon
v-if="!loadingDocId && isVerifiedDocId"
v-if="!loadingDocId && isVerifiedDocId && !generateDocumentId"
color="green-darken-2"
>
mdi-check
</v-icon>
</template>
</v-text-field>

<v-checkbox
v-if="hasDrsEnabled"
v-model="generateDocumentId"
color="primary"
class="mt-2 ml-n2 pb-0 mb-n6"
>
<template #label>
<p>Generate a Document ID Number upon filing.</p>
<v-tooltip
location="top"
contentClass="top-tooltip"
transition="fade-transition"
>
<template #activator="{ props }">
<v-icon
class="ml-1"
color="primary"
size="20"
v-bind="props"
>
mdi-information-outline
</v-icon>
</template>
<div class="pt-2 pb-2">
Upon registration, a Document ID will be generated, and a corresponding document record will be
created
</div>
</v-tooltip>
</template>
</v-checkbox>
</v-col>
</v-row>
</v-card>
Expand All @@ -78,6 +110,8 @@ import { computed, defineComponent, nextTick, reactive, ref, toRefs, watch } fro
import { validateDocumentID } from '@/utils'
import { ContentIF, FormIF, MhrDocIdResponseIF } from '@/interfaces'
import { useInputRules } from '@/composables'
import { storeToRefs } from 'pinia'
import { useStore } from '@/store/store'
export default defineComponent({
name: 'DocumentId',
Expand All @@ -100,8 +134,10 @@ export default defineComponent({
default: false
}
},
emits: ['isValid', 'setStoreProperty'],
emits: ['isValid', 'setStoreProperty', 'setGenerateDocId'],
setup (props, { emit }) {
const { setMhrGenerateDocId } = useStore()
const { hasDrsEnabled } = storeToRefs(useStore())
const { customRules, isNumber, maxLength, minLength, required } = useInputRules()
const documentIdForm = ref(null) as FormIF
Expand All @@ -112,9 +148,10 @@ export default defineComponent({
loadingDocId: false,
isUniqueDocId: false,
displayDocIdError: false,
generateDocumentId: false,
showBorderError: computed(() => props.validate && !localState.isVerifiedDocId),
isVerifiedDocId: computed(() => {
return localState.isDocumentIdFormValid && localState.isUniqueDocId
return (localState.isDocumentIdFormValid && localState.isUniqueDocId) || localState.generateDocumentId
}),
uniqueDocIdError: computed(() => {
// Manual error handling for Unique DocId Lookup
Expand All @@ -124,14 +161,14 @@ export default defineComponent({
return props.validate
? customRules(
required('Enter a Document ID'),
isNumber(),
maxLength(8, true),
minLength(8, true),
isNumber()
)
: customRules(
required('Enter a Document ID'),
isNumber(),
maxLength(8, true),
isNumber()
)
})
})
Expand All @@ -154,7 +191,7 @@ export default defineComponent({
localState.isUniqueDocId = false
localState.displayDocIdError = false
emit('isValid', false)
emit('isValid', localState.generateDocumentId)
}
localState.loadingDocId = false
Expand All @@ -167,13 +204,25 @@ export default defineComponent({
localState.documentIdModel = val
})
watch(() => localState.generateDocumentId, (val: boolean) => {
console.log(val)
localState.documentIdModel = ''
localState.loadingDocId = false
setMhrGenerateDocId(val)
emit('isValid', val)
})
return {
hasDrsEnabled,
...toRefs(localState)
}
}
})
</script>

<style lang="scss" module>
<style lang="scss" scoped>
@import '@/assets/styles/theme.scss';
:deep(.v-field--disabled .v-label.v-field-label, .v-field--focused .v-label.v-field-label) {
opacity: .4;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
</v-col>
<v-col cols="9">
<p class="content ref-text">
{{ getMhrRegistrationDocumentId || emptyText }}
{{ getMhrGenerateDocId
? 'Generate a Document ID Number upon filing'
: getMhrRegistrationDocumentId || emptyText
}}
</p>
</v-col>
</v-row>
Expand Down Expand Up @@ -193,6 +196,7 @@ export default defineComponent({
getMhrRegistrationSubmittingParty,
getMhrRegistrationDocumentId,
getMhrAttentionReference,
getMhrGenerateDocId,
getMhrRegistrationValidationModel,
isMhrManufacturerRegistration
} = storeToRefs(useStore())
Expand All @@ -215,7 +219,7 @@ export default defineComponent({
hasData: computed(() : boolean => {
return hasTruthyValue(getMhrRegistrationSubmittingParty.value) ||
(!isMhrManufacturerRegistration.value &&
(!!getMhrRegistrationDocumentId.value || !!getMhrAttentionReference.value))
(!!getMhrRegistrationDocumentId.value || !!getMhrAttentionReference.value || !!getMhrGenerateDocId.value))
})
})
Expand Down Expand Up @@ -251,6 +255,7 @@ export default defineComponent({
getMhrRegistrationSubmittingParty,
getMhrRegistrationDocumentId,
getMhrAttentionReference,
getMhrGenerateDocId,
getStepValidation,
getSubmittingPartyName,
parsePhoneNumber,
Expand Down
3 changes: 3 additions & 0 deletions ppr-ui/src/composables/mhrRegistration/useMhrValidations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { MhrCompVal, MhrSectVal } from '@/composables/mhrRegistration/enums'
export const useMhrValidations = (validationState: any) => {
/** Set specified flag */
const setValidation = (section: MhrSectVal, component: MhrCompVal, isValid: boolean): void => {
console.log('section:', section)
console.log('component:', component)
console.log('isValid:', isValid)
// Only sets specified flag if the section and component are part of the validation model
if (validationState[section]?.value[component] !== undefined) {
validationState[section].value[component] = isValid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface StateModelIF {
authorization: AuthorizationIF
certifyInformation: CertifyIF
folioOrReferenceNumber: string
generateDocId:boolean
// for amendments only
originalRegistration: {
collateral: AddCollateralIF
Expand Down
1 change: 1 addition & 0 deletions ppr-ui/src/store/state/state-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const stateModel: StateModelIF = {
certified: false,
legalName: ''
},
generateDocId: false, // Flag to indicate Document Id will be generated by API
folioOrReferenceNumber: '',
// orig reg party used for discharge/renew/amend, other for amend only
originalRegistration: {
Expand Down
11 changes: 11 additions & 0 deletions ppr-ui/src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ export const useStore = defineStore('assetsStore', () => {
const getIsStaffClientPayment = computed<boolean>(() => {
return state.value.isStaffClientPayment
})
const getMhrGenerateDocId = computed<string>(() => {
return state.value.generateDocId
})
const showStepErrors = computed<boolean>(() => {
return state.value.registration.showStepErrors
})
Expand Down Expand Up @@ -1275,6 +1278,10 @@ export const useStore = defineStore('assetsStore', () => {
setUnsavedChanges(true)
}

function setMhrGenerateDocId (value: boolean) {
state.value.generateDocId = value
}

function setMhrAttentionReference (value: string) {
state.value.mhrRegistration.attentionReference = value
setUnsavedChanges(true)
Expand Down Expand Up @@ -1626,6 +1633,7 @@ export const useStore = defineStore('assetsStore', () => {
getFolioOrReferenceNumber,
getStaffPayment,
getIsStaffClientPayment,
getMhrGenerateDocId,
showStepErrors,

// Steps and Navigation getters
Expand Down Expand Up @@ -1798,6 +1806,9 @@ export const useStore = defineStore('assetsStore', () => {
setUnsavedChanges,
setCurrentRegistrationsTab,

// MHR Global
setMhrGenerateDocId,

// MHR Registration
setEmptyMhr,
setMhrDraftNumber,
Expand Down
2 changes: 2 additions & 0 deletions ppr-ui/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export default defineComponent({
setSearchHistory,
setSearchResults,
setMhrDraftNumber,
setMhrGenerateDocId,
setSearchedType,
setSearchedValue,
setSearchDebtorName,
Expand Down Expand Up @@ -282,6 +283,7 @@ export default defineComponent({
setSearchedValue('')
setSearchResults(null)
setMhrDraftNumber('')
setMhrGenerateDocId(false)
useTransportPermits().setLocationChange(false)
useTransportPermits().setExtendLocationChange(false)
useTransportPermits().setNewPermitChange(false)
Expand Down
7 changes: 7 additions & 0 deletions ppr-ui/src/views/mhrInformation/MhrInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ export default defineComponent({
setMhrTransferType,
setMhrTransferDeclaredValue,
setEmptyMhrTransfer,
setMhrGenerateDocId,
setStaffPayment,
setEmptyMhrTransportPermit,
setMhrTransportPermit,
Expand Down Expand Up @@ -1084,6 +1085,7 @@ export default defineComponent({
context.emit('emitHaveData', true)
localState.loading = true
setMhrGenerateDocId(false)
setEmptyMhrTransfer(initMhrTransfer())
setEmptyMhrTransportPermit(initTransportPermit())
Expand Down Expand Up @@ -1116,6 +1118,7 @@ export default defineComponent({
break
case isRoleQualifiedSupplierHomeDealer.value:
localState.disableRoleBaseTransfer = await disableDealerManufacturerTransfer(true)
console.log('Is Disabling Transfer: ', localState.disableRoleBaseTransfer)
localState.disableRoleBaseLocationChange = await disableDealerManufacturerLocationChange(true)
break
}
Expand Down Expand Up @@ -1582,6 +1585,10 @@ export default defineComponent({
context.emit('actionInProgress', watchedConditions.includes(true))
}, { immediate: true })
watch( () => localState.disableRoleBaseTransfer, (val) => {
console.log('Disable Role Base Transfer', val)
})
return {
isNewPermitActive,
isRoleStaffSbc,
Expand Down
Loading

0 comments on commit 26e2cd1

Please sign in to comment.