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): class Client(models.Model):
uuid = models.UUIDField(unique=True, default=uuid.uuid4, verbose_name="Identifier") uuid = models.UUIDField(unique=True, default=uuid.uuid4, verbose_name="Identifier")
location = models.ForeignKey(Location, verbose_name="Standort") location = models.ForeignKey(Location, verbose_name="Standort")
report_user = models.ForeignKey(User, verbose_name="Reporting Benutzer", related_name='reporting_clients')
def __str__(self): def __str__(self):
return '{}, {}'.format(self.location.name, self.uuid) return '{}, {}'.format(self.location.name, self.uuid)

View File

@ -8,3 +8,23 @@
<div class="col-md-12 alert alert-danger">Keine Tische angelegt!</div> <div class="col-md-12 alert alert-danger">Keine Tische angelegt!</div>
</div> </div>
{% endif %} {% 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 loc = min_loc
locations = Location.objects.filter(users__id=request.user.id).order_by('code') locations = Location.objects.filter(users__id=request.user.id).order_by('code')
clients = Client.objects.filter(location_id=loc).order_by('id') 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 = { context = {
'range': range(1, 9), 'range': range(1, 9),
'locations': locations, 'locations': locations,
'clients': clients, 'clients': clients,
'location_id': int(loc), 'location_id': int(loc),
'accounts': accounts,
} }
return render(request, template, context=context) return render(request, template, context=context)
if request.method == 'POST': if request.method == 'POST':