Skip to content

Commit

Permalink
Merge branch 'main' into 23445-preserve-date-filter-on-registration-t…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
flutistar authored Oct 25, 2024
2 parents e9a555d + 3d59dbf commit d8520a1
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 148 deletions.
8 changes: 5 additions & 3 deletions mhr-api/src/database/postgres_views/mhr_account_reg_vw.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@
d.document_registration_number,
(SELECT d2.document_type
FROM mhr_documents d2
WHERE d2.id = (SELECT MAX(d3.id)
FROM mhr_documents d3, mhr_registrations r2
WHERE d2.id = (SELECT d3.id
FROM mhr_documents d3, mhr_registrations r2
WHERE r2.id = d3.registration_id
AND r2.mhr_number = r.mhr_number)) AS last_doc_type,
AND r2.mhr_number = r.mhr_number
ORDER BY r2.registration_ts DESC
FETCH FIRST 1 ROWS ONLY)) AS last_doc_type,
(SELECT n.status_type
FROM mhr_notes n
WHERE n.registration_id = r.id) AS note_status,
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.68",
"version": "3.2.69",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
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, getMhrGenerateDocId } = 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: getMhrGenerateDocId.value,
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) => {
localState.documentIdModel = ''
localState.loadingDocId = false
setMhrGenerateDocId(val)
emit('isValid', val)
if(!val) emit('setStoreProperty', '')
})
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
id="location-change-doc-id"
cols="9"
>
{{ getMhrTransportPermit.documentId }}
{{ getMhrTransportPermit.documentId || 'Generate a Document ID Number upon filing' }}
</v-col>
</v-row>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
cols="9"
class="details"
>
{{ unitNote.documentId }}
{{ unitNote.documentId || 'Generate a Document ID Number upon filing' }}
</v-col>
</v-row>
<v-divider class="my-3 mx-0" />
Expand Down
5 changes: 3 additions & 2 deletions ppr-ui/src/composables/mhrInformation/useMhrInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ export const useMhrInformation = () => {
getMhrTransferDocumentId,
getMhrTransferType,
getLienRegistrationType,
getMhrRegistrationLocation
getMhrRegistrationLocation,
getMhrGenerateDocId
} = storeToRefs(useStore())

const {
Expand Down Expand Up @@ -537,7 +538,7 @@ export const useMhrInformation = () => {
consideration: getMhrTransferConsideration.value,
transferDate: getMhrTransferDate.value,
ownLand: getMhrTransferOwnLand.value,
...(getMhrTransferDocumentId.value && {
...(getMhrTransferDocumentId.value && !getMhrGenerateDocId.value && {
documentId: getMhrTransferDocumentId.value
}),
registrationType: (isTransferNonGiftBillOfSale.value || isTransferWithoutBillOfSale.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => {
getStaffPayment,
getMhrDraftNumber,
getRegistrationType,
getMhrInformation
getMhrInformation,
getMhrGenerateDocId
} = storeToRefs(useStore())
const {
setShowGroups,
Expand Down Expand Up @@ -348,7 +349,7 @@ export const useNewMhrRegistration = (isMhrCorrections: boolean = false) => {
...(isRoleStaffReg.value && !!getStaffPayment.value && {
clientReferenceId: getStaffPayment.value.folioNumber
}),
...(!isMhrManufacturerRegistration.value && {
...(!isMhrManufacturerRegistration.value && !getMhrGenerateDocId.value && {
documentId: getMhrRegistrationDocumentId.value
}),
...(isMhrManufacturerRegistration.value && !!getFolioOrReferenceNumber.value && {
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
8 changes: 5 additions & 3 deletions ppr-ui/src/views/exemption/ExemptionReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ export default defineComponent({
getStaffPayment,
isRoleStaffReg,
isRoleQualifiedSupplier,
hasLien
hasLien,
getMhrGenerateDocId
} = storeToRefs(useStore())
const {
exemptionLabel,
Expand All @@ -278,8 +279,9 @@ export default defineComponent({
}),
reviewContent: computed(() => {
return [
getMhrExemption.value?.documentId
? { label: 'Document ID', property: getMhrExemption.value?.documentId }
(getMhrExemption.value?.documentId || getMhrGenerateDocId.value)
? { label: 'Document ID', property: getMhrExemption.value?.documentId ||
'Generate a Document ID Number upon filing' }
: null,
getMhrExemptionNote.value?.nonResidentialReason
? { label: 'Declaration Details', property: localState.nonResidentialDisplayReason }
Expand Down
Loading

0 comments on commit d8520a1

Please sign in to comment.