Jarvis/jarvis/location/templates/places/list.html

88 lines
3.3 KiB
HTML

{% extends "listing.html" %}
{% load has_group %}
{% block datacontent %}
<div class="card mb-0">
<div class="card-header row">
<div class="col-10">
<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="fas fa-plus"></i>
</button>
</a>
{% endif %}
</div>
</div>
</div>
<div class="card-body pt-0">
<div class="table-responsive pb-0">
{% if place_list %}
<table class="table tablesorter table-condensed 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-center" style="width: 15%">City</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-right">{{ place.postal}}</td>
<td class="text-right">{{ place.city }}</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
},
sortList: [[3, 0], [1, 0]],
{% else %}
sortList: [[2, 0], [0, 0]],
{% endif %}
dateFormat: "uk",
});
$('#place_table').DataTable({
scrollY: '50vh',
scrollCollapse: true,
paging: false,
searching: false,
ordering: false,
"bInfo": false,
});
});
</script>
{% endblock %}