add computed TotalBalance and disabled, disabled send button if TotalBalance minus

This commit is contained in:
ogerly 2022-03-31 15:20:25 +02:00
parent 69b1cf7a06
commit 7bb14f50ba

View File

@ -33,9 +33,7 @@
</b-row>
<b-row class="pr-3">
<b-col class="text-right">{{ $t('form.new_balance') }}</b-col>
<b-col class="text-right">
{{ $t('math.aprox') }} {{ (balance - amount - amount * 0.028) | GDD }}
</b-col>
<b-col class="text-right">{{ $t('math.aprox') }} {{ TotalBalance | GDD }}</b-col>
</b-row>
</b-container>
@ -44,7 +42,7 @@
<b-button @click="$emit('on-reset')">{{ $t('form.cancel') }}</b-button>
</b-col>
<b-col class="text-right">
<b-button variant="success" :disabled="loading" @click="$emit('send-transaction')">
<b-button variant="success" :disabled="disabled" @click="$emit('send-transaction')">
{{ $t('form.generate_now') }}
</b-button>
</b-col>
@ -62,6 +60,18 @@ export default {
loading: { type: Boolean, required: true },
selected: { type: String, required: true },
},
computed: {
TotalBalance() {
return this.balance - this.amount - this.amount * 0.028
},
disabled() {
if (this.TotalBalance < 0) {
return 'disabled'
}
return this.loading
},
},
}
</script>
<style>