Skip to content

Commit

Permalink
Merge pull request #3447 from betagouv/purchase-fix-validation
Browse files Browse the repository at this point in the history
Déclenche la validation après l'autofill du total HT
  • Loading branch information
alemangui authored Jan 18, 2024
2 parents cc093f4 + d3f8be6 commit 97475df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions frontend/src/components/DsfrCurrencyField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
suffix="€ HT"
v-bind="$attrs"
v-on="$listeners"
ref="text-field"
/>
</template>

Expand All @@ -23,5 +24,10 @@ export default {
return validators
},
},
methods: {
validate() {
return this.$refs["text-field"].validate()
},
},
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
@blur="updatePayload"
:error="hasError"
label="Total (en € HT) de tous mes achats alimentaires"
ref="totalField"
/>
<PurchaseHint
v-if="displayPurchaseHints"
v-model="payload.valueTotalHt"
@autofill="updatePayload"
@autofill="onPurchaseAutofill"
purchaseType="totaux"
:amount="purchasesSummary.valueTotalHt"
:class="$vuetify.breakpoint.mdAndUp ? 'narrow-field' : ''"
Expand Down Expand Up @@ -170,6 +171,10 @@ export default {
this.errorHelperUsed = true
this.checkTotal()
},
onPurchaseAutofill() {
this.updatePayload()
this.$nextTick(this.$refs.totalField.validate)
},
},
mounted() {
this.checkTotal()
Expand Down

0 comments on commit 97475df

Please sign in to comment.