Auto-focus case/unit field when showing inventory count page

This commit is contained in:
Lance Edgar 2023-10-05 13:44:08 -05:00
parent 8c6fe828ad
commit a1bf81aa56

View file

@ -44,13 +44,15 @@
<b-input v-model="row.cases" <b-input v-model="row.cases"
type="number" type="number"
step="any" step="any"
ref="cases"
:disabled="!shouldAllowCases()"> :disabled="!shouldAllowCases()">
</b-input> </b-input>
</b-field> </b-field>
<b-field label="Units" expanded> <b-field label="Units" expanded>
<b-input v-model="row.units" <b-input v-model="row.units"
type="number" type="number"
step="any"> step="any"
ref="units">
</b-input> </b-input>
</b-field> </b-field>
</b-field> </b-field>
@ -100,6 +102,16 @@ export default {
this.fetch(this.$route.params.uuid) this.fetch(this.$route.params.uuid)
}, },
updated() {
this.$nextTick(() => {
if (this.shouldAllowCases()) {
this.$refs.cases.focus()
} else {
this.$refs.units.focus()
}
})
},
methods: { methods: {
getIndexUrl() { getIndexUrl() {