Skip to content

Commit

Permalink
Merge pull request #31 from disha1202/#2hfv0u
Browse files Browse the repository at this point in the history
Implemented logic to auto fill input field on the click of a badge(#2hfv0u)
  • Loading branch information
adityasharma7 authored Mar 24, 2023
2 parents ed9cbc9 + 5912c7c commit ace65f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/views/product-details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@
</ion-item>
</div>
<div class="order-info">
<ion-badge color="success">{{ item.doclist && item.doclist.numFound ? item.doclist.numFound : 0 }} {{ $t("pieces preordered") }}</ion-badge>
<ion-badge color="success" @click="autoFillQuantity(item)">{{ item.doclist && item.doclist.numFound ? item.doclist.numFound : 0 }} {{ $t("pieces preordered") }}</ion-badge>
<ion-badge color="medium"> {{ getProductStock(item.groupValue) }} {{ $t("in stock") }}</ion-badge>
</div>
<div class="order-select">
<ion-item>
<ion-label position="floating">{{ $t("Pieces") }}</ion-label>
<ion-input type="number" min="1" @ionChange="selectVariant(item.groupValue, $event.target.value)" clear-input="true" value=""></ion-input>
<ion-input type="number" min="1" @ionChange="selectVariant(item.groupValue, $event.target.value)" clear-input="true" v-model="item.quantity"></ion-input>
</ion-item>
</div>
</ion-card>
Expand Down Expand Up @@ -290,6 +290,9 @@ export default defineComponent({
}
},
methods: {
autoFillQuantity (item: any) {
item.quantity = item.doclist.numFound;
},
filter (featureValue: any, type: any) {
if (this.filters[type].includes(featureValue)) {
const index = this.filters[type].indexOf(featureValue);
Expand Down

0 comments on commit ace65f3

Please sign in to comment.