2022-12-31 13:18:27 +00:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
|
2023-01-03 18:03:30 +00:00
|
|
|
{% block title %}Sessions{% endblock title %}
|
2022-12-31 13:18:27 +00:00
|
|
|
|
|
|
|
{% block content %}
|
2023-01-05 21:00:08 +00:00
|
|
|
{% if purchase %}
|
|
|
|
<div class="text-center text-xl mb-4 dark:text-slate-400">
|
2023-01-09 17:57:22 +00:00
|
|
|
<h1>Listing sessions only for purchaseee "{{ purchase }}" (total playtime: {{ total_duration }})</h1>
|
2023-01-05 21:00:08 +00:00
|
|
|
<a class="dark:text-white hover:underline" href="{% url 'list_sessions' %}">View all sessions</a>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
<div id="session-table" class="gap-4 shadow rounded-xl max-w-screen-lg mx-auto dark:bg-slate-700 p-2 justify-center">
|
|
|
|
<div class="dark:border-white dark:text-slate-300 text-lg">Name</div>
|
|
|
|
<div class="dark:border-white dark:text-slate-300 text-lg text-center">Start</div>
|
|
|
|
<div class="dark:border-white dark:text-slate-300 text-lg text-center">End</div>
|
|
|
|
<div class="dark:border-white dark:text-slate-300 text-lg">Duration</div>
|
|
|
|
<div class="dark:border-white dark:text-slate-300 text-lg text-right">Manage</div>
|
|
|
|
{% for data in dataset %}
|
|
|
|
<div><a class="dark:text-white hover:underline" href="{% url 'list_sessions' data.purchase.id %}">{{ data.purchase }}</a></div>
|
|
|
|
<div class="dark:text-slate-400 text-center">{{ data.timestamp_start | date:"d/m/Y H:i" }}</div>
|
|
|
|
<div class="dark:text-slate-400 text-center">
|
|
|
|
{% if data.unfinished %}
|
|
|
|
<span class="text-red-400">Not finished yet.</span>
|
|
|
|
{% elif data.duration_manual %}
|
|
|
|
--
|
|
|
|
{% else %}
|
|
|
|
{{ data.timestamp_end | date:"d/m/Y H:i" }}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2023-01-05 22:10:42 +00:00
|
|
|
<div class="dark:text-slate-400 flex">{{ data.duration_formatted }}{% if data.duration_manual %} <svg title="Added manually" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5 ml-1 self-center">
|
|
|
|
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd" />
|
|
|
|
</svg>
|
|
|
|
{% endif %}</div>
|
2023-01-05 21:00:08 +00:00
|
|
|
<div id="button-container" class="flex justify-end">
|
|
|
|
{% if data.unfinished %}
|
|
|
|
<a href="{% url 'update_session' data.id %}">
|
|
|
|
<button type="button" title="Set to finished" class="py-1 px-2 flex justify-center items-center bg-green-600 hover:bg-green-700 focus:ring-green-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 w-7 h-4 rounded-lg ">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-4 h-4">
|
|
|
|
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
<button type="button" title="Edit" class="py-1 px-2 flex justify-center items-center bg-blue-600 hover:bg-blue-700 focus:ring-blue-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 w-7 h-4 rounded-lg ">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
|
|
|
<path d="M5.433 13.917l1.262-3.155A4 4 0 017.58 9.42l6.92-6.918a2.121 2.121 0 013 3l-6.92 6.918c-.383.383-.84.685-1.343.886l-3.154 1.262a.5.5 0 01-.65-.65z" />
|
|
|
|
<path d="M3.5 5.75c0-.69.56-1.25 1.25-1.25H10A.75.75 0 0010 3H4.75A2.75 2.75 0 002 5.75v9.5A2.75 2.75 0 004.75 18h9.5A2.75 2.75 0 0017 15.25V10a.75.75 0 00-1.5 0v5.25c0 .69-.56 1.25-1.25 1.25h-9.5c-.69 0-1.25-.56-1.25-1.25v-9.5z" />
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
<a href="{% url 'delete_session' data.id %}">
|
|
|
|
<button type="button" edit="Delete" class="py-1 px-2 flex justify-center items-center bg-red-600 hover:bg-red-700 focus:ring-red-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 w-7 h-4 rounded-lg ">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
|
|
|
|
<path fill-rule="evenodd" d="M8.75 1A2.75 2.75 0 006 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 10.23 1.482l.149-.022.841 10.518A2.75 2.75 0 007.596 19h4.807a2.75 2.75 0 002.742-2.53l.841-10.52.149.023a.75.75 0 00.23-1.482A41.03 41.03 0 0014 4.193V3.75A2.75 2.75 0 0011.25 1h-2.5zM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4zM8.58 7.72a.75.75 0 00-1.5.06l.3 7.5a.75.75 0 101.5-.06l-.3-7.5zm4.34.06a.75.75 0 10-1.5-.06l-.3 7.5a.75.75 0 101.5.06l.3-7.5z" clip-rule="evenodd" />
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
2023-01-04 16:27:54 +00:00
|
|
|
</div>
|
2022-12-31 13:18:27 +00:00
|
|
|
{% endblock content %}
|