Skip to content

Commit

Permalink
Mhr Correction/Amend Button States (#1854)
Browse files Browse the repository at this point in the history
* Correction/Amend button states

* clean up
  • Loading branch information
cameron-eyds authored May 1, 2024
1 parent 14cd430 commit 8bf1463
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 14 deletions.
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.1.10",
"version": "3.1.11",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
7 changes: 6 additions & 1 deletion ppr-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
icon=" "
/>
<Breadcrumb v-if="haveData" />
<Tombstone v-if="haveData" />
<Tombstone
v-if="haveData"
:actionInProgress="actionInProgress"
/>
<v-container class="py-0">
<v-row noGutters>
<v-col cols="12">
Expand All @@ -45,6 +48,7 @@
@profileReady="profileReady = true"
@error="handleError($event)"
@haveData="haveData = $event"
@actionInProgress="actionInProgress = $event"
/>
</v-col>
</v-row>
Expand Down Expand Up @@ -156,6 +160,7 @@ export default defineComponent({
haveData: false,
loggedOut: false,
tokenService: false,
actionInProgress: false,
registryUrl: computed((): string => {
// if REGISTRY_URL does not exist this will return 'undefined'. Needs to be null or str
const configRegistryUrl = sessionStorage.getItem('REGISTRY_URL')
Expand Down
7 changes: 7 additions & 0 deletions ppr-ui/src/components/tombstone/Tombstone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TombstoneDynamic
v-if="displayTombstoneDynamic"
:isMhrInformation="displayMhrInformation"
:actionInProgress="actionInProgress"
/>
<TombstoneDefault v-else />
</v-container>
Expand All @@ -23,6 +24,12 @@ export default defineComponent({
TombstoneDefault,
TombstoneDynamic
},
props: {
actionInProgress: {
type: Boolean,
default: false
}
},
setup () {
const route = useRoute()
const { isMhrCorrection } = useMhrCorrections()
Expand Down
18 changes: 13 additions & 5 deletions ppr-ui/src/components/tombstone/TombstoneDynamic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

<!-- Mhr Amend/Correct Btns -->
<v-row
v-if="isMhrInformation && isMhrChangesEnabled && !isNonResExemption"
v-if="isMhrChangesEnabled && isRouteName(RouteNames.MHR_INFORMATION)"
noGutters
class="mt-2 mb-n4"
>
Expand All @@ -102,6 +102,7 @@
color="primary"
variant="plain"
:ripple="false"
:disabled="actionInProgress"
@click="initMhrCorrection(MhrPublicAmendment)"
>
<v-icon
Expand All @@ -125,6 +126,7 @@
variant="plain"
v-bind="props"
:ripple="false"
:disabled="actionInProgress"
>
<v-icon
color="primary"
Expand All @@ -141,6 +143,7 @@
class="ml-n3 px-0"
v-bind="props"
:ripple="false"
:disabled="actionInProgress"
>
<v-icon v-if="isActive">
mdi-menu-up
Expand Down Expand Up @@ -178,8 +181,8 @@ import { computed, defineComponent, reactive, toRefs } from 'vue'
import { useStore } from '@/store/store'
import { formatExpiryDate, pacificDate } from '@/utils'
import { RegistrationTypeIF } from '@/interfaces'
import { MhApiStatusTypes, MhUIStatusTypes } from '@/enums'
import { useExemptions, useMhrCorrections, useMhrInformation, useTransportPermits } from '@/composables'
import { MhApiStatusTypes, MhUIStatusTypes, RouteNames } from '@/enums'
import { useMhrCorrections, useMhrInformation, useNavigation, useTransportPermits } from '@/composables'
import { storeToRefs } from 'pinia'
import { MhrCorrectionClient, MhrCorrectionStaff, MhrPublicAmendment } from '@/resources'
import MhrStatusCorrection from '@/components/mhrRegistration/MhrStatusCorrection.vue'
Expand All @@ -192,6 +195,10 @@ export default defineComponent({
isMhrInformation: {
type: Boolean,
default: false
},
actionInProgress: {
type: Boolean,
default: false
}
},
setup () {
Expand All @@ -203,8 +210,8 @@ export default defineComponent({
getMhrInformation,
getMhrOriginalTransportPermitRegStatus
} = storeToRefs(useStore())
const { isRouteName } = useNavigation()
const { isFrozenMhr } = useMhrInformation()
const { isNonResExemption } = useExemptions()
const { initMhrCorrection, isMhrChangesEnabled, isMhrCorrection } = useMhrCorrections()
const { isAmendLocationActive } = useTransportPermits()
Expand Down Expand Up @@ -255,8 +262,9 @@ export default defineComponent({
})
return {
RouteNames,
isRouteName,
isMhrCorrection,
isNonResExemption,
initMhrCorrection,
isMhrChangesEnabled,
MhrCorrectionStaff,
Expand Down
15 changes: 10 additions & 5 deletions ppr-ui/src/views/mhrInformation/MhrInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,8 @@ export default defineComponent({
},
emits: [
'error',
'emitHaveData'
'emitHaveData',
'actionInProgress'
],
setup (props, context) {
const router = useRouter()
Expand Down Expand Up @@ -1454,10 +1455,9 @@ export default defineComponent({
onSave()
})
watch(() => getMhrInformation.value.frozenDocumentType,
val => {
localState.hasAlertMsg = QSLockedStateUnitNoteTypes.includes(val)
})
watch(() => getMhrInformation.value.frozenDocumentType, val => {
localState.hasAlertMsg = QSLockedStateUnitNoteTypes.includes(val)
})
watch(() => localState.transportPermitLocationType, val => {
if (val === LocationChangeTypes.TRANSPORT_PERMIT_SAME_PARK) {
Expand All @@ -1466,6 +1466,11 @@ export default defineComponent({
}
})
/** Inform root level components when there is an MHR action in Progress **/
watch(() => [localState.showTransferType, isChangeLocationActive.value], (watchedConditions) => {
context.emit('actionInProgress', watchedConditions.includes(true))
}, { immediate: true })
return {
isRoleStaffSbc,
isRoleStaffReg,
Expand Down

0 comments on commit 8bf1463

Please sign in to comment.