Skip to content

Commit

Permalink
UXA feedback and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimak1 committed Jan 25, 2024
1 parent 9fad06e commit 2091108
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 22 deletions.
9 changes: 8 additions & 1 deletion ppr-ui/src/components/dialogs/BaseDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
</v-col>
<v-col cols="1">
<v-btn
class="close-btn float-right"
class="close-btn pa-0 ma-0"
color="primary"
variant="plain"
:ripple="false"
@click="proceed(closeAction)"
>
<v-icon size="32px">
Expand Down Expand Up @@ -148,4 +149,10 @@ export default defineComponent({
height: 24px;
width: 24px;
}
.close-btn {
position: fixed;
right: 20px;
top: 35px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ export default defineComponent({
getIsManualLocation,
getMhrRegistrationOwnLand,
isMhrManufacturerRegistration,
getMhrInfoValidation
getMhrInfoValidation,
getMhrTransportPermit
} = storeToRefs(useStore())
const {
Expand All @@ -462,8 +463,8 @@ export default defineComponent({
const { required, notEqualTo, customRules } = useInputRules()
const localState = reactive({
currentPadNumber: getMhrRegistrationLocation.value.pad,
newTransportPermitPadNumber: getMhrRegistrationLocation.value.pad,
currentPadNumber: getMhrTransportPermit.value.newLocation.pad || getMhrRegistrationLocation.value.pad,
newTransportPermitPadNumber: getMhrTransportPermit.value.newLocation.pad || getMhrRegistrationLocation.value.pad,
includesPid: computed((): boolean => {
return [HomeLocationTypes.OTHER_STRATA, HomeLocationTypes.OTHER_TYPE]
.includes(getMhrRegistrationLocation.value.otherType)
Expand Down Expand Up @@ -527,7 +528,7 @@ export default defineComponent({
watch(() => localState.newTransportPermitPadNumber, (val) => {
setMhrTransportPermitNewLocation({ key: 'pad', value: val })
// new Pad should be different than the current one
setValidation('isNewPadNumberValid', localState.currentPadNumber !== val)
setValidation('isNewPadNumberValid', val && localState.currentPadNumber !== val)
})
watch(() => props.validate, async () => {
Expand Down
14 changes: 7 additions & 7 deletions ppr-ui/src/components/mhrTransportPermit/LocationChange.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ import { HomeLocationTypes, LocationChangeTypes } from "@/enums"
import { ContentIF, FormIF } from "@/interfaces"
import { locationChangeTypes } from "@/resources/mhr-transfers/transport-permits"
import { useStore } from "@/store/store"
import { reactive, computed, watch, ref, onMounted, nextTick } from "vue"
import { reactive, computed, watch, ref, nextTick } from "vue"
import { FormCard } from "../common"
import { HomeCivicAddress, HomeLandOwnership, HomeLocationType } from "../mhrRegistration"
import { CivicAddressSchema } from '@/schemas/civic-address'
Expand All @@ -156,12 +156,14 @@ const props = defineProps<{
content?: ContentIF
}>()
const emit = defineEmits(['updateLocationType'])
const { isRoleQualifiedSupplier, getMhrRegistrationLocation,
setMhrTransportPermit, setMhrTransportPermitNewLocation } = useStore()
const { hasUnsavedChanges, getMhrTransportPermit, getMhrInfoValidation } = storeToRefs(useStore())
const { setLocationChangeType, initTransportPermit, resetTransportPermit } = useTransportPermits()
const { setLocationChangeType, resetTransportPermit } = useTransportPermits()
const {
setValidation,
Expand Down Expand Up @@ -190,10 +192,6 @@ const state = reactive({
showChangeTransportPermitLocationTypeDialog: false
})
onMounted(async (): Promise<void> => {
initTransportPermit()
})
const handleTaxCertificateUpdate = (date: string) => {
setMhrTransportPermitNewLocation({ key: 'taxExpiryDate', value: date })
setMhrTransportPermitNewLocation({ key: 'taxCertificate', value: !!date })
Expand Down Expand Up @@ -237,7 +235,7 @@ const handleLocationTypeChange = (locationType: LocationChangeTypes) => {
if (locationType !== state.prevLocationChangeType && hasUnsavedChanges.value && hasTypeSelected) {
state.showChangeTransportPermitLocationTypeDialog = true
} else {
state.prevLocationChangeType = hasTypeSelected ? cloneDeep(locationType) : null
state.prevLocationChangeType = cloneDeep(locationType)
selectLocationType(locationType)
}
}
Expand All @@ -250,6 +248,8 @@ const handleChangeTransportPermitLocationTypeResp = (proceed: boolean) => {
selectLocationType(cloneDeep(state.locationChangeType))
// when changing Location Type update the validation for it after reset
setValidation('isLocationChangeTypeValid', true)
// emit location change to reset page validations
emit('updateLocationType')
} else {
selectLocationType(cloneDeep(state.prevLocationChangeType))
}
Expand Down
3 changes: 3 additions & 0 deletions ppr-ui/src/composables/mhrInformation/useMhrInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ export const useMhrInformation = () => {
isFrozenMhr: computed((): boolean => {
return getMhrInformation.value.statusType === MhApiStatusTypes.FROZEN
}),
isExemptMhr: computed((): boolean => {
return getMhrInformation.value.statusType === MhApiStatusTypes.EXEMPT
}),
isFrozenMhrDueToAffidavit: computed((): boolean => {
return localState.isFrozenMhr &&
getMhrInformation.value?.frozenDocumentType === MhApiFrozenDocumentTypes.TRANS_AFFIDAVIT
Expand Down
25 changes: 24 additions & 1 deletion ppr-ui/src/composables/mhrInformation/useTransportPermits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import { storeToRefs } from 'pinia'
import { locationChangeTypes } from '@/resources/mhr-transfers/transport-permits'
import { LocationChangeTypes } from '@/enums/transportPermits'
import { MhrRegistrationHomeLocationIF, MhrTransportPermitIF } from '@/interfaces'
import { APIRegistrationTypes, UnitNoteDocTypes } from '@/enums'

// Global constants
const isChangeLocationActive: Ref<boolean> = ref(false)

export const useTransportPermits = () => {
const { isRoleStaffReg, isRoleQualifiedSupplier } = storeToRefs(useStore())
const { isRoleStaffReg,
isRoleQualifiedSupplier ,
getLienRegistrationType, getMhrUnitNotes
} = storeToRefs(useStore())

const {
setEmptyMhrTransportPermit,
Expand Down Expand Up @@ -40,6 +44,24 @@ export const useTransportPermits = () => {
return locationChangeTypes.find(item => item.type === locationChangeType)?.feeSummaryTitle
}

const isTransportPermitDisabledQS = computed((): boolean =>
// QS role check
isRoleQualifiedSupplier.value &&
// PPR Liens check
[APIRegistrationTypes.LAND_TAX_LIEN,
APIRegistrationTypes.MAINTENANCE_LIEN,
APIRegistrationTypes.MANUFACTURED_HOME_NOTICE]
.includes(getLienRegistrationType.value as APIRegistrationTypes) &&
// Unit Notes check
getMhrUnitNotes.value
.map(note => note.documentType)
.some(note => [
UnitNoteDocTypes.NOTICE_OF_TAX_SALE,
UnitNoteDocTypes.CONFIDENTIAL_NOTE,
UnitNoteDocTypes.RESTRAINING_ORDER]
.includes(note))
)

const resetTransportPermit = async (shouldResetLocationChange: boolean = false): Promise<void> => {
setEmptyMhrTransportPermit(initTransportPermit())
shouldResetLocationChange && setLocationChange(false)
Expand Down Expand Up @@ -114,6 +136,7 @@ export const useTransportPermits = () => {
resetTransportPermit,
isChangeLocationActive,
isChangeLocationEnabled,
isTransportPermitDisabledQS,
setLocationChange,
setLocationChangeType,
getUiLocationType,
Expand Down
32 changes: 26 additions & 6 deletions ppr-ui/src/views/mhrInformation/MhrInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@
<div class="pt-4 mb-15">
<MhrTransportPermit
v-if="isChangeLocationEnabled"
:disable="showTransferType || (isFrozenMhr || (hasLien && !isLienRegistrationTypeSA))"
:disable="isTransportPermitDisabled"
:validate="validate"
@updateLocationType="setLocationChangeType($event)"
@updateLocationType="validate = false"
@cancelTransportPermitChanges="handleCancelTransportPermitChanges()"
/>
<HomeLocationReview
Expand Down Expand Up @@ -478,7 +478,8 @@ import {
MhApiStatusTypes,
RouteNames,
UIMHRSearchTypes,
LocationChangeTypes
LocationChangeTypes,
UnitNoteDocTypes

Check failure on line 482 in ppr-ui/src/views/mhrInformation/MhrInformation.vue

View workflow job for this annotation

GitHub Actions / linting (20.5.1)

'UnitNoteDocTypes' is defined but never used
} from '@/enums'
import {
useAuth,
Expand Down Expand Up @@ -586,7 +587,8 @@ export default defineComponent({
setMhrTransferType,
setMhrTransferDeclaredValue,
setEmptyMhrTransfer,
setStaffPayment
setStaffPayment,
setEmptyMhrTransportPermit
} = useStore()
const {
// Getters
Expand All @@ -612,6 +614,8 @@ export default defineComponent({
const {
isFrozenMhr,
isFrozenMhrDueToAffidavit,
isExemptMhr,
getLienInfo,
buildApiData,
initMhrTransfer,
getUiTransferType,
Expand Down Expand Up @@ -642,8 +646,17 @@ export default defineComponent({
} = useTransferOwners()
const { getActiveExemption } = useExemptions()
const { isChangeLocationActive, isChangeLocationEnabled, setLocationChange, getUiFeeSummaryLocationType,
getUiLocationType, resetTransportPermit, setLocationChangeType } = useTransportPermits()
const {
isChangeLocationActive,
isChangeLocationEnabled,
isTransportPermitDisabledQS,
setLocationChange,
getUiFeeSummaryLocationType,
getUiLocationType,
resetTransportPermit,
setLocationChangeType,
initTransportPermit
} = useTransportPermits()
// Refs
const homeOwnersComponentRef = ref(null) as Component
Expand Down Expand Up @@ -671,6 +684,11 @@ export default defineComponent({
showIncompleteRegistrationDialog: false,
showStartTransferRequiredDialog: false,
showCancelTransportPermitDialog: false,
isTransportPermitDisabled: computed((): boolean =>
localState.showTransferType ||
isExemptMhr.value ||
isTransportPermitDisabledQS.value
),
hasLienInfoDisplayed: false, // flag to track if lien info has been displayed after API check
transportPermitLocationType: computed((): LocationChangeTypes => getMhrTransportPermit.value.locationChangeType),
validateHomeLocationReview: computed((): boolean =>
Expand Down Expand Up @@ -784,6 +802,7 @@ export default defineComponent({
localState.loading = true
setEmptyMhrTransfer(initMhrTransfer())
setEmptyMhrTransportPermit(initTransportPermit())
// Set baseline MHR Information to state
await parseMhrInformation(isFrozenMhr.value)
Expand Down Expand Up @@ -1208,6 +1227,7 @@ export default defineComponent({
getMhrInfoValidation,
isValidTransportPermit,
isValidTransfer,
getLienInfo,
...toRefs(localState)
}
}
Expand Down
4 changes: 2 additions & 2 deletions ppr-ui/src/views/mhrInformation/MhrTransportPermit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<LocationChange
ref="locationChangeRef"
:validate="validate"
@updateLocationType="emit('updateLocationType')"
/>
</section>
</template>
Expand All @@ -188,7 +189,7 @@ const { disable = false, validate = false } = defineProps<{
validate: boolean
}>()
const emit = defineEmits(['cancelTransportPermitChanges'])
const emit = defineEmits(['updateLocationType', 'cancelTransportPermitChanges'])
const { setMhrTransportPermit } = useStore()
Expand All @@ -203,7 +204,6 @@ const state = reactive({
transportPermitDocumentId: computed(() => getMhrTransportPermit.value.documentId)
})
const toggleLocationChange = () => {
if (isChangeLocationActive.value) {
// trigger cancel dialog
Expand Down
3 changes: 2 additions & 1 deletion ppr-ui/tests/unit/MhrTransportPermit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { beforeEach, expect } from 'vitest'
import { DocumentId, FormCard, SimpleHelpToggle } from '@/components/common'
import { nextTick } from 'vue'
import flushPromises from 'flush-promises'
import { LocationChange, TaxCertificate } from '@/components/mhrTransfers'
import { TaxCertificate } from '@/components/mhrTransfers'
import { LocationChange } from '@/components/mhrTransportPermit'
import { AuthRoles, LocationChangeTypes, ProductCode } from '@/enums'
import { useStore } from '@/store/store'
import { HomeLocationType, HomeCivicAddress, HomeLandOwnership } from '@/components/mhrRegistration'
Expand Down

0 comments on commit 2091108

Please sign in to comment.