Merge branch 'release/0.2.3'
# Conflicts: # billard/templates/billard/base.html
This commit is contained in:
commit
2362c5d53e
@ -1,28 +1,34 @@
|
|||||||
{% if account %}
|
{% if accounts %}
|
||||||
<div id="accountsmodal" class="modal" tabindex="-1" role="dialog">
|
<div id="accountsmodal" class="modal" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title">Abrechnung: ({{ account.desk.desk_no }}) {{ account.desk.name }} </h4>
|
<h4 class="modal-title">Abrechnung</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<table class="table">
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Tisch #</td>
|
||||||
|
<td>Tisch Name</td>
|
||||||
|
<td class="text-right">Normalpreis</td>
|
||||||
|
<td class="text-right">Preis HH</td>
|
||||||
|
<td class="text-right">Gesamt</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
{% for account in accounts %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>Normalpreis:</td>
|
<td>{{ account.desk.desk_no }}</td>
|
||||||
<td>{{ account.prize_normal }}</td>
|
<td>{{ account.desk.name }}</td>
|
||||||
</tr>
|
<td class="text-right">{{ account.prize_normal }}</td>
|
||||||
<tr>
|
<td class="text-right">{{ account.prize_hh }}</td>
|
||||||
<td>Preis Happy Hour:</td>
|
<td class="text-right"><strong>{{ account.prize }}</strong></td>
|
||||||
<td>{{ account.prize_hh }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Gesamt:</td>
|
|
||||||
<td>{{ account.prize }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<a class="btn btn-default btn-primary" href="{% url 'billard:account_modal_confirm' pk=account.id loc_pk=loc_pk %}">Schliessen</a>
|
<a class="btn btn-default btn-primary" href="{% url 'billard:account_modal_confirm' pks=pks loc_pk=loc_pk %}">Schliessen</a>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.modal-content -->
|
</div><!-- /.modal-content -->
|
||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<li><a href="#">c@0.2.2</a></li>
|
<li><a href="#">c@0.2.3</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div><!--/.nav-collapse -->
|
</div><!--/.nav-collapse -->
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,7 +19,7 @@ urlpatterns = [
|
|||||||
# ex. /billard/1/account_modal/
|
# ex. /billard/1/account_modal/
|
||||||
url(r'^(?P<loc_pk>[0-9]+)/account_modal/$', views.account_modal_view, name='account_modal'),
|
url(r'^(?P<loc_pk>[0-9]+)/account_modal/$', views.account_modal_view, name='account_modal'),
|
||||||
# ex. /billard/1/account_modal/confirm/
|
# ex. /billard/1/account_modal/confirm/
|
||||||
url(r'^(?P<loc_pk>[0-9]+)/account_modal/(?P<pk>[0-9]+)/confirm/$', views.account_modal_confirm_view,
|
url(r'^(?P<loc_pk>[0-9]+)/account_modal/(?P<pks>[0-9]+(,[0-9]+)*)/confirm/$', views.account_modal_confirm_view,
|
||||||
name='account_modal_confirm'),
|
name='account_modal_confirm'),
|
||||||
# ex. /billard/api/v1/ (rest api)
|
# ex. /billard/api/v1/ (rest api)
|
||||||
url(r'api/v1/', include(router.urls)),
|
url(r'api/v1/', include(router.urls)),
|
||||||
|
@ -81,22 +81,24 @@ def accounting_confirm(request, pk):
|
|||||||
def account_modal_view(request, loc_pk):
|
def account_modal_view(request, loc_pk):
|
||||||
try:
|
try:
|
||||||
uuids = Client.objects.filter(report_user=request.user).values_list('uuid')
|
uuids = Client.objects.filter(report_user=request.user).values_list('uuid')
|
||||||
account = Accounting.objects.filter(reporter_uuid__in=uuids).first
|
accounts = Accounting.objects.filter(reporter_uuid__in=uuids)
|
||||||
# TODO: support multiple account objects
|
# TODO: support multiple account objects
|
||||||
except Client.DoesNotExist:
|
except Client.DoesNotExist:
|
||||||
account = None
|
accounts = None
|
||||||
context = {
|
context = {
|
||||||
'account': account,
|
'accounts': accounts,
|
||||||
'loc_pk': loc_pk,
|
'loc_pk': loc_pk,
|
||||||
|
'pks': ','.join([str(account.pk) for account in accounts]),
|
||||||
}
|
}
|
||||||
return render(request, 'billard/accountmodal.html', context=context)
|
return render(request, 'billard/accountmodal.html', context=context)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def account_modal_confirm_view(request, loc_pk, pk):
|
def account_modal_confirm_view(request, loc_pk, pks):
|
||||||
account = Accounting.objects.get(pk=pk)
|
for pk in pks.split(','):
|
||||||
account.reporter_uuid = None
|
account = Accounting.objects.get(pk=pk)
|
||||||
account.save()
|
account.reporter_uuid = None
|
||||||
|
account.save()
|
||||||
return redirect('billard:location_detail', pk=loc_pk)
|
return redirect('billard:location_detail', pk=loc_pk)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user