2022-12-31 13:18:27 +00:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
|
2023-02-19 15:18:14 +00:00
|
|
|
{% load static %}
|
|
|
|
|
2023-01-30 21:16:28 +00:00
|
|
|
{% block title %}{{ title }}{% endblock title %}
|
2022-12-31 13:18:27 +00:00
|
|
|
|
|
|
|
{% block content %}
|
2023-09-30 13:53:41 +00:00
|
|
|
|
2023-09-30 17:44:35 +00:00
|
|
|
{% if dataset.count >= 1 %}
|
|
|
|
<div class="mx-auto text-center my-4">
|
|
|
|
<a
|
|
|
|
id="last-session-start"
|
2023-10-13 17:22:43 +00:00
|
|
|
href="{% url 'start_session_same_as_last' last.id %}"
|
|
|
|
hx-get="{% url 'start_session_same_as_last' last.id %}"
|
2023-09-30 17:44:35 +00:00
|
|
|
hx-indicator="#indicator"
|
|
|
|
hx-swap="afterbegin"
|
|
|
|
hx-target=".responsive-table tbody"
|
|
|
|
hx-select=".responsive-table tbody tr:first-child"
|
|
|
|
onClick="document.querySelector('#last-session-start').classList.add('invisible')"
|
|
|
|
class="{% if last.timestamp_end == null %}invisible{% endif %}"
|
|
|
|
>
|
2023-10-13 17:22:43 +00:00
|
|
|
{% include 'components/button_start.html' with text=last.purchase title="Start session of last played game" only %}
|
2023-09-30 17:44:35 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2023-09-30 13:53:41 +00:00
|
|
|
|
|
|
|
<table class="responsive-table">
|
2023-09-30 17:44:35 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class="px-2 sm:px-4 md:px-6 md:py-2">Name</th>
|
|
|
|
<th class="hidden sm:table-cell px-2 sm:px-4 md:px-6 md:py-2">Start</th>
|
|
|
|
<th class="hidden lg:table-cell px-2 sm:px-4 md:px-6 md:py-2">End</th>
|
|
|
|
<th class="px-2 sm:px-4 md:px-6 md:py-2">Duration</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for data in dataset %}
|
|
|
|
<tr>
|
|
|
|
<td
|
|
|
|
class="px-2 sm:px-4 md:px-6 md:py-2 purchase-name truncate max-w-20char md:max-w-40char"
|
|
|
|
>
|
2023-10-01 19:28:02 +00:00
|
|
|
<a
|
|
|
|
class="underline decoration-slate-500 sm:decoration-2"
|
|
|
|
href="{% url 'view_game' data.purchase.edition.game.id %}">
|
|
|
|
{{ data.purchase.edition }}
|
|
|
|
</a>
|
2023-09-30 17:44:35 +00:00
|
|
|
</td>
|
|
|
|
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono hidden sm:table-cell">
|
|
|
|
{{ data.timestamp_start | date:"d/m/Y H:i" }}
|
|
|
|
</td>
|
|
|
|
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono hidden lg:table-cell">
|
|
|
|
{% if data.unfinished %}
|
|
|
|
<a
|
|
|
|
href="{% url 'update_session' data.id %}"
|
|
|
|
hx-get="{% url 'update_session' data.id %}"
|
|
|
|
hx-swap="outerHTML"
|
|
|
|
hx-target=".responsive-table tbody tr:first-child"
|
|
|
|
hx-select=".responsive-table tbody tr:first-child"
|
|
|
|
hx-indicator="#indicator"
|
|
|
|
onClick="document.querySelector('#last-session-start').classList.remove('invisible')"
|
|
|
|
>
|
|
|
|
<span class="text-yellow-300">Finish now?</span>
|
|
|
|
</a>
|
|
|
|
{% elif data.duration_manual %}
|
|
|
|
--
|
|
|
|
{% else %}
|
|
|
|
{{ data.timestamp_end | date:"d/m/Y H:i" }}
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
|
|
|
|
{{ data.duration_formatted }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
2023-09-30 13:53:41 +00:00
|
|
|
</table>
|
2023-09-17 11:28:15 +00:00
|
|
|
{% endblock content %}
|