Commit 40dad775 authored by dev0tion's avatar dev0tion

Add fee slider and password box

parent cee187c6
#sendForm { #sendForm {
padding: 10px; padding: 10px;
} }
#feeSlider {
width: 200px;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<h1>Send</h1> <h1>Send</h1>
<form [formGroup]="sendForm" (ngSubmit)="send()"> <form [formGroup]="sendForm" (ngSubmit)="send()">
<div class="form-group"> <div class="form-group">
<label>Pay To: </label> <label>Pay To</label>
<input class="form-control" formControlName="address" type="text" placeholder="Please enter the recipients address."> <input class="form-control" formControlName="address" type="text" placeholder="Please enter the recipients address.">
<div *ngIf="formErrors.address" class="alert alert-danger">{{formErrors.address}}</div> <div *ngIf="formErrors.address" class="alert alert-danger">{{formErrors.address}}</div>
</div> </div>
...@@ -11,6 +11,15 @@ ...@@ -11,6 +11,15 @@
<input class="form-control" formControlName="amount" type="text" placeholder="Please enter the amount you want to send."> <input class="form-control" formControlName="amount" type="text" placeholder="Please enter the amount you want to send.">
<div *ngIf="formErrors.amount" class="alert alert-danger">{{formErrors.amount}}</div> <div *ngIf="formErrors.amount" class="alert alert-danger">{{formErrors.amount}}</div>
</div> </div>
<div class="form-group">
<label>Fee</label>
<input class="form-control" id="feeSlider" formControlName="fee" type="range" min="1" max="3" value="2">
</div>
<div class="form-group">
<label>Wallet Password</label>
<input class="form-control" formControlName="password" type="password" placeholder="Please enter your wallet password.">
<div *ngIf="formErrors.password" class="alert alert-danger">{{formErrors.password}}</div>
</div>
<button type="submit" [disabled]="!sendForm.valid" class="btn btn-success">Send</button> <button type="submit" [disabled]="!sendForm.valid" class="btn btn-success">Send</button>
<button type="button" class="btn" (click)="activeModal.close('Close click')">Close</button> <button type="button" class="btn" (click)="activeModal.close('Close click')">Close</button>
</form> </form>
......
...@@ -26,7 +26,9 @@ export class SendComponent { ...@@ -26,7 +26,9 @@ export class SendComponent {
private buildSendForm(): void { private buildSendForm(): void {
this.sendForm = this.fb.group({ this.sendForm = this.fb.group({
"address": ["", Validators.required], "address": ["", Validators.required],
"amount": ["", Validators.required] "amount": ["", Validators.required],
"fee": [2, Validators.required],
"password": ["", Validators.required]
}); });
this.sendForm.valueChanges this.sendForm.valueChanges
...@@ -52,7 +54,9 @@ export class SendComponent { ...@@ -52,7 +54,9 @@ export class SendComponent {
formErrors = { formErrors = {
'address': '', 'address': '',
'amount': '' 'amount': '',
'fee': '',
'password': ''
}; };
validationMessages = { validationMessages = {
...@@ -61,6 +65,12 @@ export class SendComponent { ...@@ -61,6 +65,12 @@ export class SendComponent {
}, },
'amount': { 'amount': {
'required': 'An amount is required.' 'required': 'An amount is required.'
},
'fee': {
'required': 'A fee is required.'
},
'password': {
'required': 'Your password is required.'
} }
}; };
...@@ -70,10 +80,10 @@ export class SendComponent { ...@@ -70,10 +80,10 @@ export class SendComponent {
this.globalService.getWalletName(), this.globalService.getWalletName(),
this.globalService.getCoinType(), this.globalService.getCoinType(),
"account 0", "account 0",
"123", this.sendForm.get("password").value,
this.sendForm.get("address").value, this.sendForm.get("address").value,
this.sendForm.get("amount").value, this.sendForm.get("amount").value,
"medium", this.getFeeType(),
true true
); );
...@@ -96,6 +106,19 @@ export class SendComponent { ...@@ -96,6 +106,19 @@ export class SendComponent {
); );
}; };
private getFeeType(){
let feeValue = this.sendForm.get("fee").value;
switch(feeValue){
case 1:
return "low";
case 2:
return "medium";
case 3:
return "high";
}
}
private sendTransaction(hex: string) { private sendTransaction(hex: string) {
let transaction = new TransactionSending(hex); let transaction = new TransactionSending(hex);
this.apiService this.apiService
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment