reformat ajax logic only refresh desk area

This commit is contained in:
Robert Einsle 2017-02-21 08:10:00 +01:00
parent b100c15a82
commit 58252c830b
2 changed files with 15 additions and 14 deletions

View File

@ -4,12 +4,26 @@
{% block title %}Location Data{% endblock %} {% block title %}Location Data{% endblock %}
{% block content %} {% block content %}
{% if not locations|length_is:"1" %}
<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" id="location-select">
{% for loc in locations %}
<option value="{{ loc.id }}"{% if loc.id == location_id %} selected{% endif %}>{{ loc.code }} - {{ loc.name }}</option>
{% endfor %}
</select>
</div>
</form>
{% endif %}
<div id="desk_data">
{% include 'billard/index_ajax.html' %} {% include 'billard/index_ajax.html' %}
</div>
{% endblock %} {% endblock %}
{% block js %} {% block js %}
<script type="text/javascript"> <script type="text/javascript">
$( document ).ready(function() { $( document ).ready(function() {
setInterval(function(){$( "#content" ).load( "#")},1000); setInterval(function(){$( "#desk_data" ).load( "#")},2000);
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,17 +1,4 @@
{% load display_client %} {% load display_client %}
{% if not locations|length_is:"1" %}
<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" id="location-select">
{% for loc in locations %}
<option value="{{ loc.id }}"{% if loc.id == location_id %} selected{% endif %}>{{ loc.code }} - {{ loc.name }}</option>
{% endfor %}
</select>
</div>
</form>
{% endif %}
{% if clients %} {% if clients %}
{% for cli in clients %} {% for cli in clients %}
{% for i in range %} {{ cli|display_client:i }} {% endfor %} {% for i in range %} {{ cli|display_client:i }} {% endfor %}