update view, show location info
This commit is contained in:
		
							
								
								
									
										10351
									
								
								billard/static/billard/js/jquery-1.11.3.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10351
									
								
								billard/static/billard/js/jquery-1.11.3.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -41,7 +41,8 @@
 | 
				
			|||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div><!-- /.container -->
 | 
					    </div><!-- /.container -->
 | 
				
			||||||
    <script src="{% static 'billard/js/jquery-1.11.3.js' %}"></script>
 | 
					    <script src="{% static 'billard/js/jquery-1.12.4.min.js' %}"></script>
 | 
				
			||||||
    <script src="{% static 'billard/js/bootstrap.min.js' %}"></script>
 | 
					    <script src="{% static 'billard/js/bootstrap.min.js' %}"></script>
 | 
				
			||||||
 | 
					    <script src="{% static 'billard/js/carom.js' %}"></script>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										57
									
								
								billard/templates/billard/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								billard/templates/billard/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
				
			|||||||
 | 
					{% extends 'billard/base.html' %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{% block title %}Location Data{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{% block content %}
 | 
				
			||||||
 | 
					    <form action="." method="post" id="location-form">{% csrf_token %}
 | 
				
			||||||
 | 
					        <div id="location-selector" class="alert">
 | 
				
			||||||
 | 
					            <select class="form-control" form="location-form" name="location-selector">
 | 
				
			||||||
 | 
					{% for loc in locations %}
 | 
				
			||||||
 | 
					                <option value="{{ loc.id }}"{%  if loc.id == location_id %} selected{% endif %}>{{ loc.code }} - {{ loc.name }}</option>
 | 
				
			||||||
 | 
					{% endfor %}
 | 
				
			||||||
 | 
					            </select>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </form>
 | 
				
			||||||
 | 
					{% if clients %}
 | 
				
			||||||
 | 
					{% for cli in clients %}
 | 
				
			||||||
 | 
					{% if cli.desk1_enable %}
 | 
				
			||||||
 | 
					    <div class="alert alert-success">
 | 
				
			||||||
 | 
					        <h4 style="text-align: center">(1) {{ cli.desk1_name }}</h4>
 | 
				
			||||||
 | 
					        <table class="table">
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <td>01.02.2017 10:00</td>
 | 
				
			||||||
 | 
					                <td>01.02.2017 11:58</td>
 | 
				
			||||||
 | 
					                <td>6,10</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <td>01.02.2017 10:00</td>
 | 
				
			||||||
 | 
					                <td>01.02.2017 11:58</td>
 | 
				
			||||||
 | 
					                <td>6,10</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					        </table>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					{% endif %}
 | 
				
			||||||
 | 
					{% if cli.desk2_enable %}
 | 
				
			||||||
 | 
					    <div class="alert alert-info">
 | 
				
			||||||
 | 
					        <h4 style="text-align: center">(2) {{ cli.desk2_name }}</h4>
 | 
				
			||||||
 | 
					        <table class="table">
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <td>01.02.2017 10:00</td>
 | 
				
			||||||
 | 
					                <td>01.02.2017 11:58</td>
 | 
				
			||||||
 | 
					                <td>6,10</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <td>01.02.2017 10:00</td>
 | 
				
			||||||
 | 
					                <td></td>
 | 
				
			||||||
 | 
					                <td>6,10</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					        </table>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					{% endif %}
 | 
				
			||||||
 | 
					{% endfor %}
 | 
				
			||||||
 | 
					{% else %}
 | 
				
			||||||
 | 
					    <div class="alert alert-danger">Keine Tische angelegt!</div>
 | 
				
			||||||
 | 
					{% endif %}
 | 
				
			||||||
 | 
					{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -3,6 +3,13 @@
 | 
				
			|||||||
{% block title %}Location Data{% endblock %}
 | 
					{% block title %}Location Data{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% block content %}
 | 
					{% block content %}
 | 
				
			||||||
 | 
					    <div id="location-selector" class="alert">
 | 
				
			||||||
 | 
					        <select class="form-control">
 | 
				
			||||||
 | 
					            <option value="1">Casino 1</option>
 | 
				
			||||||
 | 
					            <option value="2">Casino 2</option>
 | 
				
			||||||
 | 
					        </select>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% if object_list %}
 | 
					{% if object_list %}
 | 
				
			||||||
    <h1>Location Data</h1>
 | 
					    <h1>Location Data</h1>
 | 
				
			||||||
    <table class="table table-hover">
 | 
					    <table class="table table-hover">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,8 @@ router.register(r'tables', views.TableViewSet)
 | 
				
			|||||||
router.register(r'location_data', views.LocationDataViewSet)
 | 
					router.register(r'location_data', views.LocationDataViewSet)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
urlpatterns = [
 | 
					urlpatterns = [
 | 
				
			||||||
    url(r'^$', views.IndexView.as_view(), name='index'),
 | 
					    url(r'^$', views.index, name='index'),
 | 
				
			||||||
 | 
					    #url(r'^$', views.IndexView.as_view(), name='index'),
 | 
				
			||||||
    url(r'^(?P<pk>[0-9]+)/$', views.LocationDataDetailView.as_view(), name='detail'),
 | 
					    url(r'^(?P<pk>[0-9]+)/$', views.LocationDataDetailView.as_view(), name='detail'),
 | 
				
			||||||
    url(r'api/v1/', include(router.urls)),
 | 
					    url(r'api/v1/', include(router.urls)),
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
from billard.serializers import *
 | 
					from billard.serializers import *
 | 
				
			||||||
from .models import LocationData
 | 
					from .models import LocationData
 | 
				
			||||||
from rest_framework import viewsets
 | 
					from rest_framework import viewsets
 | 
				
			||||||
 | 
					from django.shortcuts import render
 | 
				
			||||||
from django.views import generic
 | 
					from django.views import generic
 | 
				
			||||||
from django.views.generic.detail import DetailView
 | 
					from django.views.generic.detail import DetailView
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -31,3 +32,20 @@ class IndexView(generic.ListView):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class LocationDataDetailView(DetailView):
 | 
					class LocationDataDetailView(DetailView):
 | 
				
			||||||
    model = LocationData
 | 
					    model = LocationData
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def index(request):
 | 
				
			||||||
 | 
					    loc = 1
 | 
				
			||||||
 | 
					    if request.POST:
 | 
				
			||||||
 | 
					        loc = request.POST['location-selector']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    locations = Location.objects.order_by('code')
 | 
				
			||||||
 | 
					    clients = Client.objects.filter(location_id=loc).order_by('id')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    context = {
 | 
				
			||||||
 | 
					        'range': range(1, 3),
 | 
				
			||||||
 | 
					        'locations': locations,
 | 
				
			||||||
 | 
					        'clients': clients,
 | 
				
			||||||
 | 
					        'location_id': int(loc),
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return render(request, 'billard/index.html', context=context)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user