virtualtransaction: add listingz

This commit is contained in:
tkroenert 2011-10-28 21:51:28 +02:00
parent d480ea8805
commit 7e608ae6af
6 changed files with 65 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

View File

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

View File

@ -630,6 +630,14 @@ table.itemListContainer {
&.transfer { &.transfer {
background-image: url("@{fldImages}/transfer.png"); background-image: url("@{fldImages}/transfer.png");
} }
&.cashIn {
background-image: url("@{fldImages}/cashIn.png");
}
&.cashOut {
background-image: url("@{fldImages}/cashOut.png");
}
} }
.transaction { .transaction {

View File

@ -87,4 +87,51 @@
</tr> </tr>
</tfoot> </tfoot>
</table> </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 %} {% endblock %}

View File

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