rebuild location index and detail view

This commit is contained in:
2017-04-27 10:35:10 +02:00
parent 9186ed2083
commit 5477a26cbb
9 changed files with 99 additions and 33 deletions

View File

@@ -28,9 +28,9 @@
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="{% ifequal request.path '/billard/' %}active{% endifequal %}"><a href="{% url "billard:location_list" %}">Standorte</a></li>
<li class="{% ifequal request.path '/billard/' %}active{% endifequal %}"><a href="{% url "billard:location_index" %}">Standorte</a></li>
{% if perms.billard.change_accounting %}
<li class="{% ifequal request.path '/billard/accounting' %}active{% endifequal %}"><a href="{% url "billard:location_list" %}">Abrechnung</a></li>
<li class="{% ifequal request.path '/billard/accounting' %}active{% endifequal %}"><a href="{% url "billard:location_index" %}">Abrechnung</a></li>
{% endif %}
{% if user.is_superuser %}
<li class="{% ifequal request.path '/logout/' %}active{% endifequal %}"><a href="/admin/">Administration</a></li>

View File

@@ -16,12 +16,17 @@
</div>
</form>
{% endif %}
<div id="desk_data">
{% include 'billard/index_ajax.html' %}
</div>
<div id="modal-wrapper">
</div>
{% endblock %}
{% block js %}
<script type="text/javascript">
var interval;

View File

@@ -0,0 +1,25 @@
{% extends 'billard/base.html' %}
{% block title %}Standort{% endblock %}
{% block content %}
<div id="desk_data">
{% include 'billard/location_detail_ajax.html' %}
</div>
<div id="modal-wrapper">
</div>
{% endblock %}
{% block js %}
<script type="text/javascript">
var interval;
$(document).ready(function() {
$.ajaxSetup({ cache: false });
interval = window.setInterval(refresh_page, 1000);
});
function refresh_page() {
$('#desk_data').load('#');
}
</script>
{% endblock %}

View File

@@ -0,0 +1,12 @@
{% load display_client %}
{% if location.clients.all %}
{% for cli in location.clients.all %}
{% for i in "12345678" %}
{{ cli|display_client:i }}
{% endfor %}
{% endfor %}
{% else %}
<div class="col-md-12">
<div class="col-md-12 alert alert-danger">Keine Tische angelegt!</div>
</div>
{% endif %}

View File

@@ -1,10 +1,11 @@
{% extends 'billard/base.html' %}
{% block title %}Location List{% endblock %}
{% block title %}Standortliste{% endblock %}
{% block content %}
{% if location_list %}
<h2>Bitte Standort auswählen:</h2>
<table class="table table-hover">
<tr>
<th>Code</th>
@@ -15,11 +16,11 @@
</tr>
{% for loc in location_list %}
<tr>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.code }}</a></td>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.name }}</a></td>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.street }}</a></td>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.plz }}</a></td>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.city }}</a></td>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.code|default_if_none:"" }}</a></td>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.name|default_if_none:"" }}</a></td>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.street|default_if_none:"" }}</a></td>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.plz|default_if_none:"" }}</a></td>
<td><a href="{% url 'billard:location_detail' loc.id %}">{{ loc.city|default_if_none:"" }}</a></td>
</tr>
{% endfor %}
</table>