Skip to content

Commit

Permalink
MHR General items + PPR cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds committed Dec 15, 2023
1 parent 0fb6ab3 commit a50331e
Show file tree
Hide file tree
Showing 34 changed files with 144 additions and 99 deletions.
7 changes: 4 additions & 3 deletions ppr-ui/src/components/collateral/Collateral.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</v-row>
<v-container
v-if="!valid && registrationFlowType === RegistrationFlowType.NEW"
:class="{ 'invalid-message': !valid }"
:class="{ 'border-error-left': !valid }"
>
<v-row
noGutters
Expand All @@ -36,7 +36,7 @@
<v-icon color="error">
mdi-information-outline
</v-icon>&nbsp;
<span class="invalid-message">This step is unfinished. </span>
<span class="error-text">This step is unfinished. </span>
<span
id="router-link-collateral"
class="generic-link"
Expand Down Expand Up @@ -231,7 +231,8 @@ export default defineComponent({
onUnmounted(() => {
// clear general collateral description if there is no valid text left in editor (html tags not included)
if (getAddCollateral.value?.generalCollateral[0]?.description?.replace(/(<([^>]+)>)/ig, '').trim().length === 0) {
if (!!getAddCollateral.value?.generalCollateral?.length &&
getAddCollateral.value?.generalCollateral[0]?.description?.replace(/(<([^>]+)>)/ig, '')?.trim().length === 0) {
setGeneralCollateral([])
// clear collateral step check mark if there are no vehicles
// (this resets check mark that was set by general collateral description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default defineComponent({
}),
cardClass: computed((): string => {
if (localState.showErrorComponent) {
return 'invalid-message'
return 'border-error-left'
}
if (localState.showErrorBar) {
return 'border-over'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<v-card
id="general-collateral"
:class="{ 'invalid-message': showErrorComponent }"
:class="{ 'border-error-left': showErrorComponent }"
class="pa-4"
flat
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<v-col :class="{ 'box-shadow-left': showErrorBar && activeIndex >= 0 }">
<v-table
class="collateral-table vehicle-data-table"
:class="{ 'invalid-message': showErrorComponent }"
:class="{ 'border-error-left': showErrorComponent }"
>
<template #default>
<!-- Table Headers -->
Expand Down
4 changes: 2 additions & 2 deletions ppr-ui/src/components/common/RegistrationsWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ export default defineComponent({
return [...getRegTableDraftsBaseReg.value, ...getRegTableBaseRegs.value]
}
if (props.isMhr) {
console.log(getMhRegTableBaseRegs.value)
return [...getMhRegTableBaseRegs.value]
}
return []
Expand Down Expand Up @@ -397,7 +396,6 @@ export default defineComponent({
// FUTURE: add loading for search history too
localState.myRegDataLoading = true
if (getRegTableNewItem.value?.addedReg) {
console.log('New Reg Item Detected, handle new Reg Item.')
// new reg was added so don't reload the registrations + trigger new item handler
await handleRegTableNewItem(getRegTableNewItem.value)
} else if (props.isPpr) {
Expand Down Expand Up @@ -1058,6 +1056,8 @@ export default defineComponent({
setRegTableTotalRowCount(getRegTableTotalRowCount.value + 1)
}
}
} else {
await fetchMhRegistrations()
}
localState.myRegDataAdding = false
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/src/components/dialogs/SecuredPartyDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
>
<v-btn
color="primary"
icon
variant="plain"
:ripple="false"
@click="exit()"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default defineComponent({
watch(() => localState.isValidHomeLandOwnership, async (val: boolean) => {
setValidation(MhrSectVal.LOCATION_VALID, MhrCompVal.LAND_DETAILS_VALID, val)
})
}, { immediate: true })
watch(() => props.validate, () => {
validateForm()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,13 @@
</template>

<script lang="ts">
import { defineComponent, computed, reactive, toRefs, watch, onMounted } from 'vue'
import { HomeLocationInfo } from '@/components/common'
import { useStore } from '@/store/store'
import { useInputRules, useNewMhrRegistration } from '@/composables'
import { MhrLocationInfoIF } from '@/interfaces'
import { storeToRefs } from 'pinia'
export default defineComponent({
name: 'HomeLocationDescription',
components: {
Expand All @@ -174,7 +172,7 @@ export default defineComponent({
additionalDescription: getMhrRegistrationLocation.value?.additionalDescription || '',
isHomeLocationDescriptionValid: false,
isValidDescription: computed((): boolean => {
return localState.isHomeLocationDescriptionValid &&
return (props.isReserve || localState.isHomeLocationDescriptionValid) &&
((!localState.showLocationInfo && !props.isReserve) || localState.isValidLocationInfo)
}),
isValidOtherType: computed((): boolean => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,8 @@ import { useStore } from '@/store/store'
import { find } from 'lodash'
import { useMhrInformation, useTransferOwners } from '@/composables'
import { ActionTypes, HomeOwnerPartyTypes } from '@/enums'
import { AdditionalNameConfig, transfersContent } from '@/resources'
import { AdditionalNameConfig, phoneMask, transfersContent } from '@/resources'
import { storeToRefs } from 'pinia'
import { phoneMask } from '@/resources'
interface FractionalOwnershipWithGroupIdIF extends MhrRegistrationFractionalOwnershipIF {
groupId: number
Expand Down Expand Up @@ -673,7 +672,13 @@ export default defineComponent({
addHomeOwnerForm.value.validate()
await nextTick()
if (localState.isHomeOwnerFormValid && localState.isAddressFormValid) {
// validate additional name field as part of add/edit own submission
const isValidAdditionalName =
[HomeOwnerPartyTypes.OWNER_IND, HomeOwnerPartyTypes.OWNER_BUS].includes(localState.owner.partyType)
? true
: !!localState.owner[getSuffixOrDesc(localState.owner)]
if (localState.isHomeOwnerFormValid && localState.isAddressFormValid && isValidAdditionalName) {
setValidation(MhrSectVal.ADD_EDIT_OWNERS_VALID, MhrCompVal.OWNERS_VALID, true)
if (props.editHomeOwner) {
const updatedOwner = isCurrentOwner(localState.owner)
Expand Down Expand Up @@ -720,12 +725,15 @@ export default defineComponent({
setGroupFractionalInterest(localState.ownerGroupId || 1, fractionalData)
} else if (localState.group) {
// Dev Note: Left this code in but commented, currently this is deleting group data on edits
// Not sure of initial purpose of implementation. Need to research
// this condition should only occur when trying to delete a group
// clear out any fractional info
delete localState.group.type
delete localState.group.interest
delete localState.group.interestNumerator
delete localState.group.interestDenominator
// delete localState.group.type
// delete localState.group.interest
// delete localState.group.interestNumerator
// delete localState.group.interestDenominator
}
if (props.isMhrTransfer) setUnsavedChanges(props.editHomeOwner !== localState.owner)
Expand Down Expand Up @@ -772,20 +780,17 @@ export default defineComponent({
: 'description'
}
watch(
() => localState.searchValue,
(val: string) => {
if (val?.length >= 3) {
localState.autoCompleteSearchValue = val
// show autocomplete results when there is a searchValue
localState.autoCompleteIsActive = val !== ''
} else {
localState.autoCompleteSearchValue = val
localState.autoCompleteIsActive = false
}
localState.owner.organizationName = val
watch(() => localState.searchValue, (val: string) => {
if (val?.length >= 3) {
localState.autoCompleteSearchValue = val
// show autocomplete results when there is a searchValue
localState.autoCompleteIsActive = val !== ''
} else {
localState.autoCompleteSearchValue = val
localState.autoCompleteIsActive = false
}
)
localState.owner.organizationName = val
})
return {
phoneMask,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ export default defineComponent({
return groups.some(group => group.owners.filter(owner => owner.action !== ActionTypes.REMOVED).length === 0)
}),
isValidAllocation: computed((): boolean => {
return !showGroups.value || !getTotalOwnershipAllocationStatus().hasTotalAllocationError ||
return !showGroups.value || !getTotalOwnershipAllocationStatus.hasTotalAllocationError ||
[HomeTenancyTypes.SOLE, HomeTenancyTypes.JOINT].includes(getHomeTenancyType())
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<span class="generic-label">Total Ownership Allocated </span>
</v-col>
<v-col class="pl-1 gray7">
{{ getTotalOwnershipAllocationStatus().totalAllocation }}
{{ getTotalOwnershipAllocationStatus.totalAllocation }}
</v-col>
</v-row>
</article>
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/src/components/parties/debtor/Debtors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<v-col>
<v-table
class="debtor-table debtor-data-table"
:class="{ 'invalid-message': showErrorDebtors && !getDebtorValidity() }"
:class="{ 'border-error-left': showErrorDebtors && !getDebtorValidity() }"
>
<template #default>
<!-- Table Headers -->
Expand Down
4 changes: 2 additions & 2 deletions ppr-ui/src/components/parties/party/SecuredParties.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
<v-table
class="party-table party-data-table"
:class="{
'invalid-message': showErrorSecuredParties && !getSecuredPartyValidity(),
'border-error-left': setShowErrorBar
'border-error-left': (showErrorSecuredParties && !getSecuredPartyValidity()) ||
(setShowErrorBar || (isSecuredPartiesRestricted && securedParties.length >= 2))

Check warning on line 141 in ppr-ui/src/components/parties/party/SecuredParties.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

Expected indentation of 14 spaces but found 12 spaces
}"
>
<template #default>
Expand Down
4 changes: 2 additions & 2 deletions ppr-ui/src/components/parties/summaries/BasePartySummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@
<tr>
<td
:colspan="2"
class="border-error-left text-center"
class="error-text text-center"
>
<v-icon color="error">
mdi-information-outline
</v-icon>
<span class="invalid-message fs-16">This step is unfinished.</span>
<span class="error-text fs-16">This step is unfinished.</span>
<span
class="generic-link fs-16"
@click="noDataAction()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<v-card
id="amendment-detail-description"
class="px-4"
:class="{ 'invalid-message': showErrorComponent }"
:class="{ 'border-error-left': showErrorComponent }"
flat
>
<v-row class="pt-6">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
id="length-trust-component"
fluid
class="bg-white pt-0 pb-6 pr-10 pl-8 rounded noGutters"
:class="{ 'invalid-message': showInvalid }"
:class="{ 'border-error-left': showInvalid }"
>
<v-row
v-if="renewalView"
Expand Down Expand Up @@ -46,7 +46,7 @@
cols="3"
class="generic-label"
>
<span :class="{ 'invalid-message': showInvalid }">{{ regTitle }} Length</span>
<span :class="{ 'error-text': showInvalid }">{{ regTitle }} Length</span>
</v-col>
<v-col cols="auto">
<span v-if="infinityPreselected()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</v-col>
</v-row>
<v-container
:class="{ 'invalid-message': showErrorSummary }"
:class="{ 'border-error-left': showErrorSummary }"
style="padding: 40px 30px;"
>
<v-row
Expand All @@ -52,7 +52,7 @@
class="pb-6"
>
<v-col cols="auto">
<span :class="{ 'invalid-message': showErrorSummary }">
<span :class="{ 'error-text': showErrorSummary }">
<v-icon color="error">mdi-information-outline</v-icon>
This step is unfinished.
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
v-else
fluid
class="bg-white pb-6 pr-10 pl-8 rounded noGutters"
:class="{ 'invalid-message': lengthTrust.showInvalid }"
:class="{ 'border-error-left': lengthTrust.showInvalid }"
>
<v-row
v-if="renewalView"
Expand Down Expand Up @@ -177,7 +177,7 @@
cols="3"
class="generic-label pt-3"
>
<span :class="{ 'invalid-message': showErrorLienAmount }">Amount of Lien</span>
<span :class="{ 'error-text': showErrorLienAmount }">Amount of Lien</span>
</v-col>
<v-col>
<v-text-field
Expand All @@ -201,7 +201,7 @@
cols="3"
class="generic-label pt-3"
>
<span :class="{ 'invalid-message': showErrorSurrenderDate }">Surrender Date</span>
<span :class="{ 'error-text': showErrorSurrenderDate }">Surrender Date</span>
</v-col>
<v-col>
<InputFieldDatePicker
Expand Down
2 changes: 0 additions & 2 deletions ppr-ui/src/components/tables/RegistrationTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,6 @@ export default defineComponent({
// Triggers scrolling on changes to the registration history
watch(() => props.setRegistrationHistory,
() => {
console.log('Reg History Items have changed')
console.log(props.setRegistrationHistory)
if (localState.newReg?.addedReg) {
// need both (only one ref will scroll)
scrollToRef(newRegItem)
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/src/components/tables/ppr/SearchedResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
:modelValue="isSelected(item)"
/>
</v-col>
<span class="exact-match-checkbox-label mt-1">Exact Match</span>
<span class="exact-match-checkbox-label mt-1">exact match added</span>
</v-row>
</td>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Static import for the country & province list
import countryList from 'country-list/data.json'
import provinceList from 'provinces/provinces.json'
import { filterDuplicates } from '@/utils'

window['countries'] = window['countries'] || countryList
.sort((a, b) => (a.name < b.name) ? -1 : (a.name > b.name) ? 1 : 0)
Expand Down Expand Up @@ -33,8 +34,9 @@ export function useCountriesProvinces () {
countries.push({ code: '0', name: 'Can.nada. United States .Of.America', divider: true })
countries = countries.concat(window['countries'])
}
return countries
return filterDuplicates(countries, 'code')
}

/**
* Helper function to return a country's name.
* @param code The short code of the country.
Expand Down
Loading

0 comments on commit a50331e

Please sign in to comment.