Browse Source

virtualtransaction: add listingz

master
tkroenert 11 years ago
parent
commit
7e608ae6af
  1. BIN
      k4ever/media/css/img/cashIn.png
  2. BIN
      k4ever/media/css/img/cashOut.png
  3. 6
      k4ever/media/css/style.css
  4. 10
      k4ever/media/css/style.less
  5. 47
      k4ever/transaction/templates/transaction/overview.html
  6. 5
      k4ever/transaction/views.py

BIN
k4ever/media/css/img/cashIn.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

BIN
k4ever/media/css/img/cashOut.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

6
k4ever/media/css/style.css

@ -611,6 +611,12 @@ table.itemListContainer > tbody > tr:first-child ~ tr > td { @@ -611,6 +611,12 @@ table.itemListContainer > tbody > tr:first-child ~ tr > td {
.icon.transfer {
background-image: url("img/transfer.png");
}
.icon.cashIn {
background-image: url("img/cashIn.png");
}
.icon.cashOut {
background-image: url("img/cashOut.png");
}
.transaction {
padding: 0 30px;
}

10
k4ever/media/css/style.less

@ -630,6 +630,14 @@ table.itemListContainer { @@ -630,6 +630,14 @@ table.itemListContainer {
&.transfer {
background-image: url("@{fldImages}/transfer.png");
}
&.cashIn {
background-image: url("@{fldImages}/cashIn.png");
}
&.cashOut {
background-image: url("@{fldImages}/cashOut.png");
}
}
.transaction {
@ -680,4 +688,4 @@ table.itemListContainer { @@ -680,4 +688,4 @@ table.itemListContainer {
background: #E6EFC2;
color: #264409;
border-color: #C6D880;
}
}

47
k4ever/transaction/templates/transaction/overview.html

@ -87,4 +87,51 @@ @@ -87,4 +87,51 @@
</tr>
</tfoot>
</table>
<h2>Vergangene virtuelle Transaktionen</h2>
<table class="textData">
<thead>
<tr>
<th>Datum</th>
<th>Uhrzeit</th>
<th>Betrag</th>
<th>Sender</th>
<th>Typ</th>
<th>Recipient</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
{% for transaction in vhistory %}
<tr>
<td>{{ transaction.dateTime|date:"j. F Y" }}</td>
<td>{{ transaction.dateTime|date:"H:i" }} Uhr</td>
<td>{{ transaction.amount|floatformat:2 }}€</td>
<td>{{ transaction.user }}</td>
<td><script type="text/javascript">
if ('{{ user.username }}' == '{{ transaction.user }}'){
document.write('<span class="icon cashOut" title="Zahlung abgebucht">Zahlung abgebucht</span>');
} else {
document.write('<span class="icon cashIn" title="Zahlung eingegangen">Zahlung eingegangen</span>');
}
</script></td>
<td>{{ transaction.recipient }}</td>
<td>{{ transaction.comment }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Datum</th>
<th>Uhrzeit</th>
<th>Betrag</th>
<th>Sender</th>
<th>Typ</th>
<th>Recipient</th>
<th>Comment</th>
</tr>
</tfoot>
</table>
{% endblock %}

5
k4ever/transaction/views.py

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.http import HttpResponseRedirect
from models import Transaction, TransactionType, VirtualTransaction
from forms import TransactionForm, VirtualTransactionForm
@ -11,7 +12,7 @@ def overview(request): @@ -11,7 +12,7 @@ def overview(request):
""" Creates an overview over the users transactions, also handles adding and transfering money. """
# create history
history = Transaction.objects.filter(user=request.user).order_by("-dateTime")
vhistory = VirtualTransaction.objects.filter(Q(user=request.user) | Q(recipient=request.user)).order_by("-dateTime")
# create forms
form = TransactionForm()
vform = VirtualTransactionForm()
@ -39,5 +40,5 @@ def overview(request): @@ -39,5 +40,5 @@ def overview(request):
vtransacted = True
else:
error = True
return render_to_response("transaction/overview.html", {'history': history, 'form': form, 'transacted': transacted, 'error': error, 'vform': vform, 'vtransacted': vtransacted, 'verror': verror}, RequestContext(request))
return render_to_response("transaction/overview.html", {'history': history, 'vhistory': vhistory, 'form': form, 'transacted': transacted, 'error': error, 'vform': vform, 'vtransacted': vtransacted, 'verror': verror}, RequestContext(request))

Loading…
Cancel
Save