Update commodity and transaction details and list

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-03-26 15:18:41 -04:00
parent c320f81181
commit cf2b4ab06d
9 changed files with 211 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
{% extends "trading/base.html" %}
{% load bootstrap4 %}
{% load humanize %}
{% block title %}
{% with title="Commodity detail" %}
@@ -13,4 +14,46 @@
<h4>{{object.name}}</h4>
</div>
</div>
<div class="row">
<div class="col-sm">
<table class="table">
<tbody>
<tr>
<td scope="row">Created by</td>
<td>{{object.created_by.username}}</td>
</tr>
{% if object.symbol %}
<tr>
<td scope="row">Trading symbol</td>
<td>{{object.symbol}}</td>
</tr>
{% endif %}
<tr>
<td scope="row">In circulation</td>
<td>{{object.in_circulation|intcomma}}</td>
</tr>
<tr>
<td scope="row">Held in pending transactions</td>
<td>{{object.amount_pending|intcomma}}</td>
</tr>
<tr>
<td scope="row">Trading volume (all time)</td>
<td>{{trading_volume_all|intcomma}}</td>
</tr>
<tr>
<td scope="row">Trading volume (past 24 hours)</td>
<td>{{trading_volume_day|intcomma}}</td>
</tr>
<tr>
<td scope="row">Trading volume (past hour)</td>
<td>{{trading_volume_hour|intcomma}}</td>
</tr>
<tr>
<td scope="row">Market spread</td>
<td>{{object.market_spread|intcomma}} user{{object.market_spread|pluralize}} ({{market_spread_ratio|intcomma}}%)</td>
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %}

View File

@@ -14,10 +14,12 @@
<table class="table">
<thead>
<tr>
<th>Transaction ID</th>
<th>Commodity sent</th>
<th>Commodity received</th>
<th>Amount sent</th>
<th>Amount received</th>
<th>Status</th>
<th>ID</th>
</tr>
</thead>
<tbody>

View File

@@ -1,12 +1,18 @@
{% load humanize %}
<tr>
<td><a href="{% url "trading:tx_detail" object.id %}">{{object.id}}</a></td>
{% if object.source == request.user %}
<td>{{object.source_amount}}x {{object.source_sends.name}}</td>
<td>{{object.dest_amount}}x {{object.dest_sends.name}}</td>
<td>{{object.source_sends.url|safe}}</td>
<td>{{object.source_amount|intcomma}}</td>
<td>{{object.dest_sends.url|safe}}</td>
<td>{{object.dest_amount|intcomma}}</td>
{% else %}
<td>{{object.dest_amount}}x {{object.dest_sends.name}}</td>
<td>{{object.source_amount}}x {{object.source_sends.name}}</td>
<td>{{object.dest_sends.url|safe}}</td>
<td>{{object.dest_amount|intcomma}}</td>
<td>{{object.source_sends.url|safe}}</td>
<td>{{object.source_amount|intcomma}}</td>
{% endif %}
<td>{{object.status | title}}</td>
<td><a href="{% url "trading:tx_detail" object.id %}">{{object.id}}</a></td>
</tr>

View File

@@ -3,7 +3,7 @@
{% load humanize %}
{% block title %}
{% with title="Transaction detail" %}
{% with title="Transactions" %}
{{ block.super }}
{% endwith %}
{% endblock title %}
@@ -14,10 +14,12 @@
<table class="table">
<thead>
<tr>
<th>Transaction ID</th>
<th>Commodity sent</th>
<th>Commodity received</th>
<th>Amount sent</th>
<th>Amount received</th>
<th>Status</th>
<th>ID</th>
</tr>
</thead>
<tbody>