1
0
Fork 0
forked from lthn/blockchain

alias corrections

This commit is contained in:
wildkif 2019-02-18 12:30:46 +02:00
parent 8f425506cb
commit 474d17efc6
3 changed files with 6 additions and 4 deletions

View file

@ -24,7 +24,7 @@
<label for="alias-comment">
{{ 'EDIT_ALIAS.COMMENT.LABEL' | translate }}
</label>
<textarea id="alias-comment" [(ngModel)]="alias.comment" [ngModelOptions]="{standalone: true, updateOn: 'blur'}" placeholder="{{ 'EDIT_ALIAS.COMMENT.PLACEHOLDER' | translate }}"></textarea>
<textarea id="alias-comment" [(ngModel)]="alias.comment" [ngModelOptions]="{standalone: true}" placeholder="{{ 'EDIT_ALIAS.COMMENT.PLACEHOLDER' | translate }}"></textarea>
<div class="error-block" *ngIf="alias.comment.length > 0 && notEnoughMoney">
{{ 'EDIT_ALIAS.FORM_ERRORS.NO_MONEY' | translate }}
</div>
@ -33,7 +33,7 @@
<div class="alias-cost">{{ "EDIT_ALIAS.COST" | translate : {value: variablesService.default_fee, currency: variablesService.defaultCurrency} }}</div>
<div class="wrap-buttons">
<button type="button" class="blue-button" (click)="updateAlias()" [disabled]="notEnoughMoney">{{ 'EDIT_ALIAS.BUTTON_EDIT' | translate }}</button>
<button type="button" class="blue-button" (click)="updateAlias()" [disabled]="notEnoughMoney || oldAliasComment === alias.comment">{{ 'EDIT_ALIAS.BUTTON_EDIT' | translate }}</button>
<button type="button" class="blue-button" (click)="back()">{{ 'EDIT_ALIAS.BUTTON_CANCEL' | translate }}</button>
</div>

View file

@ -15,6 +15,7 @@ export class EditAliasComponent implements OnInit {
wallet: Wallet;
alias: any;
oldAliasComment: 'string';
notEnoughMoney: boolean;
constructor(
@ -33,11 +34,12 @@ export class EditAliasComponent implements OnInit {
address: alias.address,
comment: alias.comment
};
this.oldAliasComment = alias.comment;
this.notEnoughMoney = this.wallet.unlocked_balance.isLessThan(this.variablesService.default_fee_big);
}
updateAlias() {
if (this.notEnoughMoney) {
if (this.notEnoughMoney || this.oldAliasComment === this.alias.comment) {
return;
}
this.backend.updateAlias(this.wallet.wallet_id, this.alias, this.variablesService.default_fee, (status) => {

View file

@ -31,7 +31,7 @@
<label for="alias-transfer">
{{ 'TRANSFER_ALIAS.ADDRESS.LABEL' | translate }}
</label>
<input type="text" id="alias-transfer" [(ngModel)]="transferAddress" [ngModelOptions]="{standalone: true, updateOn: 'blur'}" (ngModelChange)="changeAddress()" placeholder="{{ 'TRANSFER_ALIAS.ADDRESS.PLACEHOLDER' | translate }}">
<input type="text" id="alias-transfer" [(ngModel)]="transferAddress" [ngModelOptions]="{standalone: true}" (ngModelChange)="changeAddress()" placeholder="{{ 'TRANSFER_ALIAS.ADDRESS.PLACEHOLDER' | translate }}">
<div class="error-block" *ngIf="transferAddress.length > 0 && (transferAddressAlias || !transferAddressValid || (transferAddressValid && !permissionSend) || notEnoughMoney)">
<div *ngIf="!transferAddressValid">
{{ 'TRANSFER_ALIAS.FORM_ERRORS.WRONG_ADDRESS' | translate }}