add checkboxes for accounting
This commit is contained in:
parent
7a2fed8ad0
commit
4d0cb78cb6
@ -15,27 +15,30 @@
|
||||
|
||||
{{ pk }}
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Start-Datum:</th>
|
||||
<th>Stop-Datum:</th>
|
||||
<th>Preis Normal:</th>
|
||||
<th>Preis Happy Hour:</th>
|
||||
<th>Preis gesamt:</th>
|
||||
</tr>
|
||||
{% for acc in accounting %}
|
||||
<tr>
|
||||
<td>{{ acc.time_from }}</td>
|
||||
<td>{{ acc.time_to }}</td>
|
||||
<td>{{ acc.prize_normal }}</td>
|
||||
<td>{{ acc.prize_hh }}</td>
|
||||
<td>{{ acc.prize }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<form action="confirm/" method="post" id="accounting">
|
||||
{% csrf_token %}
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Start-Datum:</th>
|
||||
<th>Stop-Datum:</th>
|
||||
<th>Preis Normal:</th>
|
||||
<th>Preis Happy Hour:</th>
|
||||
<th>Preis gesamt:</th>
|
||||
</tr>
|
||||
{% for acc in accounting %}
|
||||
<tr>
|
||||
<td><input type="checkbox" name="list_acc_id" id="option{{ acc.id }}"
|
||||
value={{ acc.id }} checked="checked"/></td>
|
||||
<td>{{ acc.time_from }}</td>
|
||||
<td>{{ acc.time_to }}</td>
|
||||
<td>{{ acc.prize_normal }}</td>
|
||||
<td>{{ acc.prize_hh }}</td>
|
||||
<td>{{ acc.prize }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<input type="hidden" name="location-selector" value="{{ location_id }}">
|
||||
<input type="hidden" name="accountings" value="{{ acc_ids }}">
|
||||
<button type="submit" class="btn btn-danger">Abrechnen</button>
|
||||
|
@ -1,16 +1,14 @@
|
||||
import ast
|
||||
import logging
|
||||
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
from django.db.models import Sum
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render, redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils import timezone
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import generic
|
||||
from django.views.generic import UpdateView
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from rest_framework import viewsets
|
||||
|
||||
from billard.models import LocationData, Location, Client, Accounting
|
||||
@ -71,7 +69,7 @@ class AccountingView(generic.ListView):
|
||||
def accounting_confirm(request, pk):
|
||||
if request.method == 'POST':
|
||||
if 'accountings' in request.POST:
|
||||
acc_ids = ast.literal_eval(request.POST['accountings'])
|
||||
acc_ids = request.POST.getlist('list_acc_id')
|
||||
if len(acc_ids) > 0:
|
||||
Accounting.objects.filter(id__in=acc_ids).update(
|
||||
billed=True,
|
||||
|
Loading…
Reference in New Issue
Block a user