Jarvis/jarvis/people/templates/gymnasts/tabs/tab_events_and_notes.html

217 lines
9.0 KiB
HTML

{% load has_group %}
{% if latest_published_note %}
<div class="row justify-content-center ml-1">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h4 class="mb-0">{{ latest_published_note.title }}</h4>
<p class="text-muted">{{ latest_published_note.date | date:'j N Y' }}</p>
</div>
<div class="card-body pt-0">
<p>{{ latest_published_note.to_markdown | safe }}</p>
</div>
</div>
</div>
</div>
{% endif %}
<div class="row justify-content-center ml-1">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h4>Next events</h4>
</div>
<div class="card-body pt-0 pb-0 pr-1 pl-1">
{% if next_event_list %}
<table class="table tablesorter table-condensed table-striped" id="next_events">
<thead>
<tr>
<th style="width: 25%" class='header text-left'>Name</th>
<th style="width: 9%" class='header text-center'>Date</th>
<th style="width: 7%" class='header text-center'># weeks</th>
</tr>
</thead>
<tbody>
{% for event in next_event_list %}
<tr>
<td class="text-left"><a href="{% url 'event_details' event.id %}">{{ event.name }}</a></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>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="pl-2 pb-3 text-muted">No next event associated to this gymnast.</p>
{% endif %}
</div>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h4>Last notes</h4>
</div>
<div class="card-body pt-0 pb-0 pr-1 pl-1">
{% if last_notes_list %}
<table class="table tablesorter table-condensed table-striped" id="notes">
<thead>
<tr>
<th style="width: 5%"></th>
<th style="width: 20%" class='header text-center'>Date</th>
<th style="width: 55%" class='header text-center'>Title</th>
<th style="width: 30%" class='header text-center'>Coach</th>
</tr>
</thead>
<tbody>
{% for note in last_notes_list %}
<tr>
<td class="text-left">
<a href="{% url 'note_update' note.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
<td class="text-right">
{% if not note.status %}
<span class="text-danger">{{ note.date | date:"j-m-Y" }}</span>
{% else %}
{{ note.date | date:"j-m-Y" }}
{% endif %}
&nbsp;&nbsp;
</td>
<td class="text-left">
<a href="{% url 'note_details' note.id %}">{{ note.title }}</a>
</td>
<td class="text-center">{{ note.coach }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="pl-2 text-muted">No note for this gymnast.</p>
{% endif %}
</div>
<div class="card-footer text-right text-muted pt-0">
{% if request.user|has_group:"trainer" %}
<a href="{% url 'note_create_for_gymnast' gymnast_id %}">
<button type="submit" value="add" class="btn btn-icon btn-warning ">
<i class="fas fa-plus"></i>
</button>
</a>
{% endif %}
</div>
</div>
</div>
</div>
{% if previous_events %}
<div class="row justify-content-center ml-3 pr-0">
<div class="col-md-12 pr-0">
<div class="card">
<div class="card-header">
<h4>Previous event</h4>
</div>
<div class="card-body">
<table class="table" id="previous_events">
<thead>
<tr>
<th></th>
<th class='header text-left'>Event's name</th>
<th class='header text-left'>Type</th>
<th class='header text-center'>Date</th>
<th class='header text-center'># weeks</th>
<th class='header text-left'>Place</th>
</tr>
</thead>
<tbody>
{% for event in previous_event %}
<tr>
<td class="text-left">
<a href="{% url 'event_update' event.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
<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">{{ event.number_of_week_from_today }}</td>
<td class="text-left"><a href="{% url 'place_details' event.place.id %}">{{ event.place.name }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-12 pr-0">
<div class="card">
<div class="card-header">
<h4>Last notes</h4>
</div>
<div class="card-body">
<table class="table" id="previous_events">
<thead>
<tr>
<th></th>
<th class='header text-center'>Date</th>
<th class='header text-center'>Coach</th>
<!-- <th class='header text-left'>Place</th> -->
</tr>
</thead>
<tbody>
{% for note in last_notes_list %}
<tr>
<td class="text-left">
<a href="{% url 'note_update' note.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
</a>
</td>
<td class="text-left"><a href="{% url 'note_details' note.id %}">{{ note.created_at |
date:"d-m-Y" }}</a></td>
<td class="text-left">{{ note.coach }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#next_events').tablesorter({
dateFormat: "uk",
headers: {
0: { sorter: false }, // disable first column
},
sortList: [[3, 0]]
});
});
$(document).ready(function () {
$('#notes').tablesorter({
dateFormat: "uk",
headers: {
0: { sorter: false }, // disable first column
},
sortList: [[3, 1]],
});
});
$(document).ready(function () {
$('#previous_events').tablesorter({
dateFormat: "uk",
headers: {
0: { sorter: false }, // disable first column
},
sortList: [[3, 1]],
});
});
</script>
{% endif %}