Jarvis/jarvis/core/templates/search/results.html

264 lines
11 KiB
HTML

{% extends "base.html" %}
<!-- {% block page_title %}.: Search results :.{% endblock %} -->
{% block title %}Search results{% endblock %}
{% block content %}
<div class="card mb-0">
{% if gymnast_list or skill_list or event_list or place_list or club_list %}
{% if gymnast_list %}
<div class="card-header">
<h4 class="mb-0"> Gymnasts results</h4>
</div>
<div class="card-body pt-0 pb-1">
<div class="table-responsive pb-0">
<table class="table tablesorter table-striped" data-sort="table" id="gymnast_table">
<thead>
<tr>
<th class="header text-left" style="width: 20%">Firstname</th>
<th class="header text-left" style="width: 20%">Lastname</th>
<th class="header text-left" style="width: 15%">Gender</th>
<th class="header text-left" style="width: 15%">Age</th>
</tr>
</thead>
<tbody>
{% for gymnast in gymnast_list %}
<tr role="row" class="{% cycle 'odd' 'even' %}">
<td class="text-left">
<a href="{% url 'gymnast_details' gymnast.id %}">{{ gymnast.first_name }}</a>
</td>
<td class="text-left">
<a href="{% url 'gymnast_details' gymnast.id %}">{{ gymnast.last_name }}</a>
</td>
<td class="text-left">{{ gymnast.get_gender_display }}</td>
<td class="text-left">{{ gymnast.age }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% if skill_list %}
<div class="card-header">
<h4 class="mb-0"> Skills results</h4>
</div>
<div class="card-body pt-0 pb-1">
<div class="table-responsive pb-0">
<table class="table tablesorter table-striped" data-sort="table" id="skill_table">
<thead class="text-primary">
<tr>
<th class="text-left">&nbsp;Long Label</th>
<th class="text-left">&nbsp;Short Label</th>
<th class="text-center">&nbsp;Age Girl</th>
<th class="text-center">&nbsp;Age Boy</th>
<th class="text-center">Notation</th>
<th class="header text-center">Diff.</th>
<th class="header text-center">Level</th>
<th class="header text-center">Rank</th>
</tr>
</thead>
<tbody>
{% for skill in skill_list %}
<tr role="row" class="{% cycle 'odd' 'even' %}">
<td class="text-left">&nbsp;<a href="{% url 'skill_details' skill.id %}">{{ skill.long_label }}</a></td>
<td class="text-left"><a href="{% url 'skill_details' skill.id %}">{{ skill.short_label }}</a></td>
<td class="text-right">{{ skill.age_girl_masterised }}</td>
<td class="text-right">{{ skill.age_boy_masterised }}</td>
<td class="text-center">{{ skill.notation }}</td>
<td class="text-center">{{ skill.difficulty }}</td>
<td class="text-center">{{ skill.level }}</td>
<td class="text-center">{{ skill.rank }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% if event_list %}
<div class="card-header">
<h4 class="mb-0"> Events results</h4>
</div>
<div class="card-body pt-0 pb-1">
<div class="table-responsive pb-0">
<table class="table tablesorter table-striped" data-sort="table" id="event_table">
<thead>
<tr>
<th class="text-left">Event</th>
<th class="text-left">Type</th>
<th class="text-center">Date</th>
<th class="text-center"># week</th>
<th class="text-left">Place</th>
</tr>
</thead>
<tbody>
{% for event in event_list %}
<tr role="row" class="{% cycle 'odd' 'even' %}">
<td class="text-left"><a href="{% url 'event_details' event.id %}">{{ event.name }}</a></td>
<td class="text-left">{{ event.event_type.name }}</td>
<td class="text-center">{{ event.date_begin | date:"d-m-Y"}}</td>
<td class="text-center">{% if event.number_of_week_from_today < 0 %}{{event.number_of_week_from_today}}{% else %}<span class="text-{% if event.number_of_week_from_today > 12 %}success{% elif event.number_of_week_from_today > 9 %}info{% elif event.number_of_week_from_today > 6 %}warning{% else %}danger{% endif %}"><b>{{event.number_of_week_from_today}}</b></span>{% endif %}</td>
<td class="text-left">{{ event.place }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% if place_list %}
<div class="card-header">
<h4 class="mb-0"> Places results</h4>
</div>
<div class="card-body pt-0 pb-1">
<div class="table-responsive pb-0">
<table class="table tablesorter table-striped" data-sort="table" id="place_table">
<thead>
<tr>
<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' %}">
<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>
</div>
</div>
{% endif %}
{% if club_list %}
<div class="card-header">
<h4 class="mb-0"> Clubs results</h4>
</div>
<div class="card-body pt-0 pb-1">
<div class="table-responsive pb-0">
<table class="table tablesorter table-striped" data-sort="table" id="club_table">
<thead>
<tr>
<th class="header text-left" style="width: 35%">Name</th>
<th class="header text-left" style="width: 10%">Acronym</th>
<th class="header text-left" style="width: 35%">City</th>
</tr>
</thead>
<tbody>
{% for club in club_list %}
<tr>
<td class="text-left"> {{ club.name }}</td>
<td class="text-left">{{ club.acronym }}</td>
<td class="text-left">{{ club.place.city }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% else %}
<div class="card-header">
<h4 class="mb-0"> Search results</h4>
</div>
<div class="card-body">
<p>There are no items corresponding to your criterias : "{{ pattern }}"</p>
</div>
{% endif %}
{% endblock %}
{% block footerscript %}
<script type="text/javascript">
$(document).ready(function() {
$('#gymnast_table').tablesorter({
headers: {
0: { sorter: false }, // disable first column
},
dateFormat: "uk",
sortList: [[1,0], [2,0]]
})
$('#gymnast_table').DataTable({
paging: false,
searching: false,
ordering: false,
"bInfo" : false,
});
$('#skill_table').tablesorter({
headers: {
4: { sorter: false },
},
sortList: [[0,0], [1,0]]
})
$('#skill_table').DataTable({
paging: false,
searching: false,
ordering: false,
"bInfo" : false,
});
$('#event_table').tablesorter({
headers: {
0: { sorter: false }, // disable first column
},
dateFormat: "uk",
sortList: [[3,1], [1,0]]
});
$('#event_table').DataTable({
paging: false,
searching: false,
ordering: false,
"bInfo" : false,
});
$('#place_table').tablesorter({
headers: {
0: { sorter: false }, // disable first column
},
dateFormat: "uk",
sortList: [[3,0], [1,0]]
});
$('#place_table').DataTable({
paging: false,
searching: false,
ordering: false,
"bInfo" : false,
});
$('#club_table').tablesorter({
sortList: [[0,0], [2,0]]
});
$('#club_table').DataTable({
paging: false,
searching: false,
ordering: false,
"bInfo" : false,
});
});
</script>
{% endblock %}