Skip to content

Commit 97475df

Browse files
authored
Merge pull request #3447 from betagouv/purchase-fix-validation
Déclenche la validation après l'autofill du total HT
2 parents cc093f4 + d3f8be6 commit 97475df

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

frontend/src/components/DsfrCurrencyField.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
suffix="€ HT"
99
v-bind="$attrs"
1010
v-on="$listeners"
11+
ref="text-field"
1112
/>
1213
</template>
1314

@@ -23,5 +24,10 @@ export default {
2324
return validators
2425
},
2526
},
27+
methods: {
28+
validate() {
29+
return this.$refs["text-field"].validate()
30+
},
31+
},
2632
}
2733
</script>

frontend/src/views/DiagnosticTunnel/QualityMeasureSteps/QualityTotalStep.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
@blur="updatePayload"
99
:error="hasError"
1010
label="Total (en € HT) de tous mes achats alimentaires"
11+
ref="totalField"
1112
/>
1213
<PurchaseHint
1314
v-if="displayPurchaseHints"
1415
v-model="payload.valueTotalHt"
15-
@autofill="updatePayload"
16+
@autofill="onPurchaseAutofill"
1617
purchaseType="totaux"
1718
:amount="purchasesSummary.valueTotalHt"
1819
:class="$vuetify.breakpoint.mdAndUp ? 'narrow-field' : ''"
@@ -170,6 +171,10 @@ export default {
170171
this.errorHelperUsed = true
171172
this.checkTotal()
172173
},
174+
onPurchaseAutofill() {
175+
this.updatePayload()
176+
this.$nextTick(this.$refs.totalField.validate)
177+
},
173178
},
174179
mounted() {
175180
this.checkTotal()

0 commit comments

Comments
 (0)