Transaction page completed
This commit is contained in:
parent
0416eb63ce
commit
8559417f24
@ -1,5 +1,5 @@
|
||||
from flask import render_template
|
||||
from flask import render_template, flash, redirect, url_for
|
||||
from flask import render_template, flash, redirect, url_for, request
|
||||
from app import app
|
||||
from app.forms import SearchForm, BlankForm
|
||||
import sqlite3
|
||||
@ -29,9 +29,10 @@ def index():
|
||||
c.execute('SELECT address,SUM(transferBalance) FROM transactiontable GROUP BY address')
|
||||
balanceTable = c.fetchall()
|
||||
conn.close()
|
||||
return render_template('test.html', form=form, blankform=blankform, balance=balance, transactionHistoryTable=transactionHistoryTable, balanceTable=balanceTable)
|
||||
return render_template('index.html', form=form, blankform=blankform, balance=balance, transactionHistoryTable=transactionHistoryTable, balanceTable=balanceTable)
|
||||
|
||||
if blankform.validate_on_submit():
|
||||
return "str"
|
||||
flash('Balance requested for address {}'.format(form.address.data))
|
||||
conn = sqlite3.connect(dblocation)
|
||||
c = conn.cursor()
|
||||
@ -42,6 +43,23 @@ def index():
|
||||
c.execute('SELECT address,SUM(transferBalance) FROM transactiontable GROUP BY address')
|
||||
balanceTable = c.fetchall()
|
||||
conn.close()
|
||||
return render_template('test.html', form=form, blankform=blankform, balance=balance, transactionHistoryTable=transactionHistoryTable, balanceTable=balanceTable)
|
||||
return render_template('index.html', form=form, blankform=blankform, balance=balance, transactionHistoryTable=transactionHistoryTable, balanceTable=balanceTable)
|
||||
|
||||
return render_template('index.html', form=form, blankform=blankform, transactionHistoryTable=transactionHistoryTable, balanceTable=balanceTable)
|
||||
return render_template('index.html', form=form, blankform=blankform, transactionHistoryTable=transactionHistoryTable, balanceTable=balanceTable)
|
||||
|
||||
@app.route('/transactions', methods=['GET', 'POST'])
|
||||
def transactions():
|
||||
address = request.args.get('address')
|
||||
if address is not None:
|
||||
conn = sqlite3.connect(dblocation)
|
||||
c = conn.cursor()
|
||||
c.execute('SELECT * FROM transactionHistory WHERE fromAddress="{}" OR toAddress="{}" ORDER BY id DESC'.format(address,address))
|
||||
transactionHistoryTable = c.fetchall()
|
||||
conn.close()
|
||||
return render_template('transactions.html', transactionHistoryTable=transactionHistoryTable)
|
||||
conn = sqlite3.connect(dblocation)
|
||||
c = conn.cursor()
|
||||
c.execute('SELECT * FROM transactionHistory ORDER BY id DESC')
|
||||
transactionHistoryTable = c.fetchall()
|
||||
conn.close()
|
||||
return render_template('transactions.html', transactionHistoryTable=transactionHistoryTable)
|
||||
|
||||
@ -36,16 +36,13 @@
|
||||
<span class="navbar-toggler-bar"></span>
|
||||
<span class="navbar-toggler-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="https://www.creative-tim.com">RMT Explorer</a>
|
||||
<a class="navbar-brand" href="/">RMT Explorer</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="navbarToggler">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item">
|
||||
<a href="../index.html" class="nav-link"><i class="nc-icon nc-layout-11"></i>Components</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="../documentation/tutorial-components.html" target="_blank" class="nav-link"><i
|
||||
class="nc-icon nc-book-bookmark"></i> Documentation</a>
|
||||
<a href="https://ranchimall.net" target="_blank" class="nav-link"><i
|
||||
class="nc-icon nc-shop"></i> Ranchi Mall</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" rel="tooltip" title="Like us on Facebook" data-placement="bottom"
|
||||
@ -79,15 +76,13 @@
|
||||
<div class="row">
|
||||
<nav class="footer-nav">
|
||||
<ul>
|
||||
<li><a href="https://www.creative-tim.com">Creative Tim</a></li>
|
||||
<li><a href="http://blog.creative-tim.com">Blog</a></li>
|
||||
<li><a href="https://www.creative-tim.com/license">Licenses</a></li>
|
||||
<li><a href="https://ranchimall.net" target="_blank">Ranchi Mall</a></li>
|
||||
<li><a href="http://medium.com/ranchimall" target="_blank">Medium</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="credits ml-auto">
|
||||
<span class="copyright">
|
||||
© <script>document.write(new Date().getFullYear())</script>, made with <i
|
||||
class="fa fa-heart heart"></i> by Creative Tim
|
||||
© <script>document.write(new Date().getFullYear())</script>, Ranchi Mall
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
{% if balance %}
|
||||
<div class="ml-auto mr-auto">
|
||||
<br/>
|
||||
<p>Balance {{balance}} RMT</p>
|
||||
<p>Balance - {{balance}} RMT<a href={{url_for('transactions', address=form.address.data)}} class="btn btn-link btn-info">Related transactions</a></p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@ -85,10 +85,11 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="col-md-6 ml-auto mr-auto text-center">
|
||||
<btn class="btn btn-outline-default btn-round"><i
|
||||
<a href="/transactions"> <btn class="btn btn-outline-default btn-round"><i
|
||||
class="nc-icon nc-paper"></i>
|
||||
View all
|
||||
</btn>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -18,36 +18,13 @@
|
||||
<div class="section section-buttons">
|
||||
<div class="container">
|
||||
<div class="tim-title">
|
||||
<h2>RMT Balance</h2>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<form action="" method="post" novalidate>
|
||||
<div class="form-group">
|
||||
<!--<input type="text" class="form-control" placeholder="Enter FLO address">-->
|
||||
{{ form.hidden_tag() }}
|
||||
{{ form.address(class="form-control", placeholder="Enter FLO address", length=100) }}
|
||||
{% for error in form.address.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
{% if balance %}
|
||||
<div class="ml-auto mr-auto">
|
||||
<br/>
|
||||
<p>Balance {{balance}} RMT</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<h2>Transactions</h2>
|
||||
</div>
|
||||
<!-- Start of tables -->
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card card-plain">
|
||||
<div class="tim-title">
|
||||
<h3>Latest Transactions</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
@ -84,41 +61,6 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="col-md-6 ml-auto mr-auto text-center">
|
||||
<btn class="btn btn-outline-default btn-round"><i class="nc-icon nc-paper"></i>
|
||||
View all
|
||||
</btn>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Table 2 -->
|
||||
<div class="col-md-12">
|
||||
<div class="card card-plain">
|
||||
<div class="tim-title">
|
||||
<h3>Balances</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead class=" text-primary">
|
||||
<th>
|
||||
Address
|
||||
</th>
|
||||
<th>
|
||||
Balance
|
||||
</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in balanceTable %}
|
||||
<tr>
|
||||
<td>{{item[0]}}</td>
|
||||
<td>{{item[1]}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user