Added modal view

This commit is contained in:
Alexander Werner 2017-03-02 20:25:40 +01:00
parent d4a68683fa
commit 3a2c21cbc2
3 changed files with 24 additions and 1 deletions

View File

@ -53,6 +53,7 @@ class Location(models.Model):
class Client(models.Model):
uuid = models.UUIDField(unique=True, default=uuid.uuid4, verbose_name="Identifier")
location = models.ForeignKey(Location, verbose_name="Standort")
report_user = models.ForeignKey(User, verbose_name="Reporting Benutzer", related_name='reporting_clients')
def __str__(self):
return '{}, {}'.format(self.location.name, self.uuid)
@ -172,4 +173,4 @@ def process_location_data():
ld.processed = True
ld.error_msg = 'No existing accountings found. Stopp processing! {}, {}'.format(ld.client_id, ld.desk_no)
ld.save()
log.error(ld.error_msg)
log.error(ld.error_msg)

View File

@ -7,4 +7,24 @@
<div class="col-md-12">
<div class="col-md-12 alert alert-danger">Keine Tische angelegt!</div>
</div>
{% endif %}
{% if accounts %}
<div class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Kischte Kischte Kischte</h4>
</div>
<div class="modal-body">
{% for acc in accounts %}
<p>{{ acc.desk }} - {{ acc.time_from }} bis {{ acc.time_to }} - {{ prize }}</p>
{% endfor %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{% endif %}

View File

@ -54,11 +54,13 @@ def index(request):
loc = min_loc
locations = Location.objects.filter(users__id=request.user.id).order_by('code')
clients = Client.objects.filter(location_id=loc).order_by('id')
accounts = Accounting.objects.filter(reporter_uuid__in=Client.objects.filter(report_user=request.user))
context = {
'range': range(1, 9),
'locations': locations,
'clients': clients,
'location_id': int(loc),
'accounts': accounts,
}
return render(request, template, context=context)
if request.method == 'POST':