Ultron/templates/locations/places/list.html

98 lines
4.2 KiB
HTML
Raw Normal View History

2021-11-02 14:05:32 +01:00
{% extends "listing.html" %}
2022-02-06 15:44:55 +01:00
{% load has_group %}
2021-11-02 14:05:32 +01:00
{% block datacontent %}
<div class="card mb-0">
<div class="card-header">
2021-11-13 07:55:26 +01:00
<div class="row">
<div class="col-2">
2021-11-30 18:45:03 +01:00
<h4 class=""> Places Listing</h4>
2021-11-13 07:55:26 +01:00
</div>
<div class="col-1 ml-auto">
2021-11-30 18:46:17 +01:00
<div class="text-right">
2022-09-04 16:04:22 +02:00
{% if request.user|has_group:"trainer" %}
2022-02-06 15:44:55 +01:00
<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 %}
2021-11-30 18:46:17 +01:00
</div>
2021-11-13 07:55:26 +01:00
</div>
</div>
2021-11-02 14:05:32 +01:00
</div>
2021-11-19 13:11:25 +01:00
<div class="card-body">
<div class="table-responsive">
2021-11-17 10:39:16 +01:00
{% if place_list %}
<table class="table tablesorter table-striped" data-sort="table" id="place_table">
2021-11-02 14:05:32 +01:00
<thead>
<tr>
2022-09-04 16:04:22 +02:00
{% if request.user|has_group:"trainer" %}
2022-02-06 15:44:55 +01:00
<th style="width: 3%"></th>
{% endif %}
2021-11-17 10:39:16 +01:00
<th class="header text-left" style="width: 27%">Name</th>
<th class="header text-left" style="width: 35%">Address</th>
2021-12-04 19:17:59 +01:00
<th class="header text-center" style="width: 10%">Zip</th>
2021-11-17 10:39:16 +01:00
<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> -->
2021-11-17 10:39:16 +01:00
<!-- <th class="header text-center">Active ?</th> -->
2021-11-02 14:05:32 +01:00
</tr>
</thead>
<tbody>
2021-11-17 10:39:16 +01:00
{% for place in place_list %}
<tr role="row" class="{% cycle 'odd' 'even' %}">
2022-09-04 16:04:22 +02:00
{% if request.user|has_group:"trainer" %}
2022-02-06 15:44:55 +01:00
<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>
2021-11-02 14:05:32 +01:00
{% endfor %}
</tbody>
</table>
{% else %}
<p class="muted-text">There are no places corresponding to your criterias.</p>
2021-11-02 14:05:32 +01:00
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% block footerscript %}
<script type="text/javascript">
$(document).ready(function() {
$('#place_table').tablesorter({
2022-09-04 16:04:22 +02:00
{% if request.user|has_group:"trainer" %}
2022-02-06 15:44:55 +01:00
headers: {
0: { sorter: false }, // disable first column
},
{% endif %}
2021-11-02 14:05:32 +01:00
dateFormat: "uk",
2022-09-04 16:04:22 +02:00
{% if request.user|has_group:"trainer" %}
2022-02-06 15:44:55 +01:00
sortList: [[3,0], [1,0]]
{% else %}
sortList: [[2,0], [0,0]]
{% endif %}
});
$('#place_table').DataTable({
2022-02-10 21:49:39 +01:00
scrollY: 475,
scrollCollapse: true,
paging: false,
searching: false,
ordering: false,
// "bInfo" : false,
});
2021-11-02 14:05:32 +01:00
});
</script>
{% endblock %}