Skip to content

Commit

Permalink
refactor(UI): On new price, scroll UI to the form (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn authored Dec 1, 2024
1 parent eff962a commit 50bd742
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/views/AddPriceMultiple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
</v-btn>
<v-form v-else @submit.prevent="createPrice">
<v-card
id="product-price-form"
class="mb-4"
:title="$t('AddPriceMultiple.ProductPriceDetails.NewPrice')"
prepend-icon="mdi-tag-plus-outline"
Expand All @@ -73,7 +74,7 @@
<v-divider />
<v-card-text>
<ProductInputRow :productForm="productPriceForm" @filled="productFormFilled = $event" />
<v-row v-if="productFormFilled && existingProductFound" class="mt-0 pb-2">
<v-row v-if="productFormFilled && existingProductFound" class="mt-0">
<v-col>
<v-alert data-name="existing-product-alert" type="warning" variant="outlined" icon="mdi-alert">
<p>
Expand Down Expand Up @@ -140,6 +141,7 @@

<script>
import { defineAsyncComponent } from 'vue'
import { useGoTo } from 'vuetify'
import { mapStores } from 'pinia'
import { useAppStore } from '../store'
import api from '../services/api'
Expand All @@ -154,6 +156,7 @@ export default {
},
data() {
return {
goTo: useGoTo(),
// price form
addPriceMultipleForm: {
type: null,
Expand Down Expand Up @@ -274,6 +277,8 @@ export default {
this.productPriceForm.mode = this.appStore.user.last_product_mode_used // can be overriden in ProductInputRow
this.productPriceForm.price_per = this.categoryPricePerList[0].key // init to 'KILOGRAM' because it's the most common use-case
this.productPriceForm.currency = this.addPriceMultipleForm.currency || this.appStore.getUserLastCurrencyUsed // get currency from proof first
// scroll to the form
this.goTo('#product-price-form')
},
createPrice() {
this.createPriceLoading = true
Expand Down

0 comments on commit 50bd742

Please sign in to comment.