Ultron/templates/locations/places/list.html

98 lines
4.2 KiB
HTML

{% extends "listing.html" %}
{% load has_group %}
{% block datacontent %}
<div class="card mb-0">
<div class="card-header">
<div class="row">
<div class="col-2">
<h4 class=""> Places Listing</h4>
</div>
<div class="col-1 ml-auto">
<div class="text-right">
{% if request.user|has_group:"trainer" %}
<a href="{% url 'place_create' %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="tim-icons icon-simple-add"></i>
</button>
</a>
{% endif %}
</div>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
{% if place_list %}
<table class="table tablesorter table-striped" data-sort="table" id="place_table">
<thead>
<tr>
{% if request.user|has_group:"trainer" %}
<th style="width: 3%"></th>
{% endif %}
<th class="header text-left" style="width: 27%">Name</th>
<th class="header text-left" style="width: 35%">Address</th>
<th class="header text-center" style="width: 10%">Zip</th>
<th class="header text-left" style="width: 15%">City</th>
<!-- <th class="header text-left" style="width: 4%">#km</th>
<th class="header text-left" style="width: 4%">#min</th> -->
<!-- <th class="header text-center">Active ?</th> -->
</tr>
</thead>
<tbody>
{% for place in place_list %}
<tr role="row" class="{% cycle 'odd' 'even' %}">
{% if request.user|has_group:"trainer" %}
<td>
<a href="{% url 'place_update' place.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
{% endif %}
<td class="text-left"><a href="{% url 'place_details' place.id %}">{{ place.name }}</a></td>
<td class="text-left">{{ place.address }}</td>
<td class="text-left">{{ place.postal}}</td>
<td class="text-left">{{ place.city }}</td>
<!-- <td class="text-center">{% if place.nbkm %}{{ place.nbkm }}{% else %}0{% endif %}</td>
<td class="text-center">{% if place.timing %}{{ place.timing }}{% else %}0{% endif %}</td> -->
<!-- <td class="text-center">{{ place.active }}</td> -->
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="muted-text">There are no places corresponding to your criterias.</p>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% block footerscript %}
<script type="text/javascript">
$(document).ready(function() {
$('#place_table').tablesorter({
{% if request.user|has_group:"trainer" %}
headers: {
0: { sorter: false }, // disable first column
},
{% endif %}
dateFormat: "uk",
{% if request.user|has_group:"trainer" %}
sortList: [[3,0], [1,0]]
{% else %}
sortList: [[2,0], [0,0]]
{% endif %}
});
$('#place_table').DataTable({
scrollY: 475,
scrollCollapse: true,
paging: false,
searching: false,
ordering: false,
// "bInfo" : false,
});
});
</script>
{% endblock %}