Commit 40dad775 authored by dev0tion's avatar dev0tion

Add fee slider and password box

parent cee187c6
#sendForm {
padding: 10px;
}
#feeSlider {
width: 200px;
}
......@@ -2,7 +2,7 @@
<h1>Send</h1>
<form [formGroup]="sendForm" (ngSubmit)="send()">
<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.">
<div *ngIf="formErrors.address" class="alert alert-danger">{{formErrors.address}}</div>
</div>
......@@ -11,6 +11,15 @@
<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>
<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="button" class="btn" (click)="activeModal.close('Close click')">Close</button>
</form>
......
......@@ -26,7 +26,9 @@ export class SendComponent {
private buildSendForm(): void {
this.sendForm = this.fb.group({
"address": ["", Validators.required],
"amount": ["", Validators.required]
"amount": ["", Validators.required],
"fee": [2, Validators.required],
"password": ["", Validators.required]
});
this.sendForm.valueChanges
......@@ -52,7 +54,9 @@ export class SendComponent {
formErrors = {
'address': '',
'amount': ''
'amount': '',
'fee': '',
'password': ''
};
validationMessages = {
......@@ -61,6 +65,12 @@ export class SendComponent {
},
'amount': {
'required': 'An amount is required.'
},
'fee': {
'required': 'A fee is required.'
},
'password': {
'required': 'Your password is required.'
}
};
......@@ -70,10 +80,10 @@ export class SendComponent {
this.globalService.getWalletName(),
this.globalService.getCoinType(),
"account 0",
"123",
this.sendForm.get("password").value,
this.sendForm.get("address").value,
this.sendForm.get("amount").value,
"medium",
this.getFeeType(),
true
);
......@@ -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) {
let transaction = new TransactionSending(hex);
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