Commit 5e0431fa authored by dev0tion's avatar dev0tion

Fix fee radio buttons

parent 3780b9f7
export class TransactionBuilding { export class TransactionBuilding {
constructor(walletName: string, coinType: number, accountName: string, password: string, destinationAddress: string, amount: string, feeType: string, allowUnconfirmed: boolean) { constructor(walletName: string, accountName: string, password: string, destinationAddress: string, amount: string, feeType: string, allowUnconfirmed: boolean) {
this.walletName = walletName; this.walletName = walletName;
this.coinType = coinType;
this.accountName = accountName; this.accountName = accountName;
this.password = password; this.password = password;
this.destinationAddress = destinationAddress; this.destinationAddress = destinationAddress;
...@@ -12,7 +11,6 @@ export class TransactionBuilding { ...@@ -12,7 +11,6 @@ export class TransactionBuilding {
} }
walletName: string; walletName: string;
coinType: number;
accountName: string; accountName: string;
password: string; password: string;
destinationAddress: string; destinationAddress: string;
......
...@@ -20,51 +20,34 @@ ...@@ -20,51 +20,34 @@
<input type="text" class="form-control form-control-success" formControlName="address" id="destinationAddress" placeholder="Please enter the destination address here."> <input type="text" class="form-control form-control-success" formControlName="address" id="destinationAddress" placeholder="Please enter the destination address here.">
<div *ngIf="formErrors.address" class="form-control-feedback">{{ formErrors.address }}</div> <div *ngIf="formErrors.address" class="form-control-feedback">{{ formErrors.address }}</div>
</div> </div>
<!-- <div class="form-group">
<label for="Fees">Fees</label>
<div class="col feeSlider text-center">
<input class="form-control" id="dataSlider" type="text"
data-provide="slider"
data-slider-ticks="[1, 2, 3]"
data-slider-ticks-labels='["Low", "Medium", "High"]'
data-slider-min="1"
data-slider-max="3"
data-slider-step="1"
data-slider-value="2"
data-slider-tooltip="hide">
</div>
<p class="text-muted text-center">
<em>A higher fee helps expedite your transaction.
<br>You are sending <strong>1 BTC</strong> with an included <strong>Medium</strong> fee of <strong>0.0001</strong>.</em>
</p>
</div> -->
<div class="form-group clearfix"> <div class="form-group clearfix">
<label for="feeSlider">Fee</label> <label>Transaction Fee</label>
<!-- fee buttons --> <!-- fee buttons -->
<div class="radioButtons" data-toggle="buttons"> <div class="radioButtons" ngbRadioGroup name="feeButtons" formControlName="fee">
<label class="btn btn-outline-danger"> <label ngbButtonLabel class="btn btn-outline-danger">
<input type="radio" name="options" id="option1" autocomplete="off"> Slow <input ngbButton type="radio" value="low">Low/Slow
</label> </label>
<label class="btn btn-outline-warning"> <label ngbButtonLabel class="btn btn-outline-warning">
<input type="radio" name="options" id="option2" autocomplete="off" checked> Medium <input ngbButton type="radio" value="medium">Medium
</label> </label>
<label class="btn btn-outline-success"> <label ngbButtonLabel class="btn btn-outline-success">
<input type="radio" name="options" id="option3" autocomplete="off"> Fast <input ngbButton type="radio" value="high">High/Fast
</label> </label>
</div> </div>
<p>Here is the line to put the fee estimation.</p>
<!-- /fee buttons --> <!-- /fee buttons -->
</div> </div>
<div class="form-group clearfix"> <div class="form-group clearfix">
<label for="walletPassword">Wallet Password</label> <label for="walletPassword">Wallet Password</label>
<input type="password" class="form-control form-control-success" formControlName="password" id="walletPassword" placeholder="Please enter your wallet password."> <input type="password" class="form-control form-control-success" formControlName="password" id="walletPassword" placeholder="Please enter your wallet password.">
<div *ngIf="formErrors.password" class="form-control-feedback">{{formErrors.password}}</div> <div *ngIf="formErrors.password" class="form-control-feedback">{{formErrors.password}}</div>
</div> </div>
<!-- <div class="form-group clearfix">
<button type="button" class="btn btn-link" (click)="buildTransaction()" [disabled]="!sendForm.valid">Estimate Fee</button> <button type="button" class="btn btn-link" (click)="buildTransaction()" [disabled]="!sendForm.valid">Estimate Fee</button>
<label *ngIf="estimatedFee">Estimated Fee: </label> <div *ngIf="estimatedFee">
<label *ngIf="estimatedFee">{{ estimatedFee | coinNotation }} {{ coinUnit }}</label> <label>Estimated Fee: </label>
--> <label>{{ estimatedFee | coinNotation }} {{ coinUnit }}</label>
</div>
</div>
</form> </form>
<!-- /form--> <!-- /form-->
</div> </div>
......
...@@ -38,7 +38,7 @@ export class SendComponent implements OnInit { ...@@ -38,7 +38,7 @@ export class SendComponent implements OnInit {
this.sendForm = this.fb.group({ this.sendForm = this.fb.group({
"address": ["", Validators.required], "address": ["", Validators.required],
"amount": ["", Validators.compose([Validators.required, Validators.pattern(/^[0-9]+(\.[0-9]{0,8})?$/)])], "amount": ["", Validators.compose([Validators.required, Validators.pattern(/^[0-9]+(\.[0-9]{0,8})?$/)])],
"fee": [2, Validators.required], "fee": ["medium", Validators.required],
"password": ["", Validators.required] "password": ["", Validators.required]
}); });
...@@ -89,12 +89,11 @@ export class SendComponent implements OnInit { ...@@ -89,12 +89,11 @@ export class SendComponent implements OnInit {
public buildTransaction() { public buildTransaction() {
this.transaction = new TransactionBuilding( this.transaction = new TransactionBuilding(
this.globalService.getWalletName(), this.globalService.getWalletName(),
this.globalService.getCoinType(),
"account 0", "account 0",
this.sendForm.get("password").value, 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,
this.getFeeType(), this.sendForm.get("fee").value,
true true
); );
...@@ -164,19 +163,6 @@ export class SendComponent implements OnInit { ...@@ -164,19 +163,6 @@ export class SendComponent implements OnInit {
; ;
} }
private getFeeType(){
let feeValue = this.sendForm.get("fee").value;
switch(feeValue){
case 1:
return "low";
case 2:
return "medium";
case 3:
return "high";
}
}
private openConfirmationModal() { private openConfirmationModal() {
const modalRef = this.modalService.open(SendConfirmationComponent); const modalRef = this.modalService.open(SendConfirmationComponent);
modalRef.componentInstance.transaction = this.transaction; modalRef.componentInstance.transaction = this.transaction;
......
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { ClipboardModule } from 'ngx-clipboard'; import { ClipboardModule } from 'ngx-clipboard';
import { WalletComponent } from './wallet.component'; import { WalletComponent } from './wallet.component';
...@@ -21,7 +21,7 @@ import { TransactionDetailsComponent } from './transaction-details/transaction-d ...@@ -21,7 +21,7 @@ import { TransactionDetailsComponent } from './transaction-details/transaction-d
ClipboardModule, ClipboardModule,
FormsModule, FormsModule,
SharedModule.forRoot(), SharedModule.forRoot(),
NgbDropdownModule, NgbModule,
ReactiveFormsModule, ReactiveFormsModule,
WalletRoutingModule WalletRoutingModule
], ],
......
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