Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #200 from LiskHQ/194_maximum-amount-validation
Browse files Browse the repository at this point in the history
Fix maximum amount validation - Closes #194
  • Loading branch information
karmacoma authored May 10, 2017
2 parents c70678b + 4e38024 commit ce6ee4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/app/components/send/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ app.component('send', {
this.$scope.$watch('$ctrl.account.balance', () => {
this.amount.max = lsk.normalize(this.account.get().balance - 10000000);
});

this.$scope.$watch('$ctrl.amount.value', () => {
if (this.amount.value) {
this.sendForm.amount.$setValidity('max', parseFloat(this.amount.value) <= parseFloat(this.amount.max));
}
});
}

reset() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/send/send.pug
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ div.dialog-send(aria-label='Send funds')
div(layout="row")
md-input-container.md-block.flex-95
label Transaction Amount
input(type='text', name='amount', ng-model='$ctrl.amount.value', required, ng-pattern='$ctrl.amount.regexp', ng-disabled='$ctrl.loading', ng-max='$ctrl.amount.max')
input(type='text', name='amount', ng-model='$ctrl.amount.value', required, ng-pattern='$ctrl.amount.regexp', ng-disabled='$ctrl.loading')
div.fee(ng-show='$ctrl.amount.value') Fee: 0.1 LSK
div(ng-messages='$ctrl.sendForm.amount.$error')
div(ng-message='required') Required
Expand All @@ -35,4 +35,4 @@ div.dialog-send(aria-label='Send funds')
md-dialog-actions(layout='row')
md-button.md-raised.md-secondary(ng-disabled='$ctrl.loading', ng-click='$ctrl.cancel()') {{ 'Cancel' }}
span(flex)
md-button.md-raised.md-primary(ng-disabled='!$ctrl.sendForm.$valid || $ctrl.loading', ng-click='$ctrl.sendLSK()') {{ $ctrl.loading ? 'Sending...' : 'Send' }}
md-button.md-raised.md-primary(ng-disabled='!$ctrl.sendForm.$valid || $ctrl.loading', ng-click='$ctrl.sendLSK()') {{ $ctrl.loading ? 'Sending...' : 'Send' }}

0 comments on commit ce6ee4d

Please sign in to comment.