Improve focus behavior for inventory count view

This commit is contained in:
Lance Edgar 2023-12-11 13:16:59 -06:00
parent 0f56b478fc
commit 0609fdebf7

View file

@ -83,6 +83,10 @@ export default {
type: Boolean,
default: true,
},
focusCases: {
type: Boolean,
default: false,
},
allowEdit: {
type: Boolean,
default: false,
@ -92,6 +96,7 @@ export default {
default: false,
},
},
data() {
return {
row: {},
@ -102,16 +107,6 @@ export default {
this.fetch(this.$route.params.uuid)
},
updated() {
this.$nextTick(() => {
if (this.shouldAllowCases()) {
this.$refs.cases.focus()
} else {
this.$refs.units.focus()
}
})
},
methods: {
getIndexUrl() {
@ -165,6 +160,14 @@ export default {
if (this.row.batch_executed || this.row.batch_complete) {
// cannot edit this row, so view it instead
this.$router.push(this.getViewUrl())
} else {
this.$nextTick(() => {
if (this.shouldAllowCases() && this.focusCases) {
this.$refs.cases.focus()
} else {
this.$refs.units.focus()
}
})
}
}, response => {
if (response.status == 403) { // forbidden; redirect to model index