timetracker/games/templates/view_game.html

110 lines
6.3 KiB
HTML
Raw Normal View History

2023-10-01 19:28:02 +00:00
{% extends "base.html" %}
2023-11-17 20:06:57 +00:00
{% block title %}
{{ title }}
{% endblock title %}
2023-10-01 19:28:02 +00:00
{% load static %}
2024-02-09 20:37:35 +00:00
{% load markdown_extras %}
2023-10-01 19:28:02 +00:00
{% block content %}
<div class="dark:text-white max-w-sm sm:max-w-xl lg:max-w-3xl mx-auto">
2024-07-09 21:03:03 +00:00
<div id="game-info" class="mb-10">
<div class="flex gap-5 mb-3">
<span class="text-wrap max-w-80 text-4xl">
<span class="font-bold font-serif">{{ game.name }}</span>&nbsp;<span data-popover-target="popover-year" class="text-slate-500 text-2xl">{{ game.year_released }}</span>
2024-08-04 20:40:43 +00:00
{% #popover id="popover-year" %}
2024-08-08 12:47:51 +00:00
Original release year
2024-08-04 20:40:43 +00:00
{% /popover %}
2024-07-09 21:03:03 +00:00
</span>
</div>
<div class="flex gap-4 dark:text-slate-400 mb-3">
<span data-popover-target="popover-hours" class="flex gap-2 items-center">
2024-08-08 12:47:51 +00:00
<svg xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-6">
2024-07-09 21:03:03 +00:00
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
</svg>
{{ hours_sum }}
{% #popover id="popover-hours" %}
2024-08-08 12:47:51 +00:00
Total hours played
2024-07-09 21:03:03 +00:00
{% /popover %}
</span>
2024-08-08 12:47:51 +00:00
<span data-popover-target="popover-sessions"
class="flex gap-2 items-center">
<svg xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-6">
2024-07-09 21:03:03 +00:00
<path stroke-linecap="round" stroke-linejoin="round" d="M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5" />
</svg>
{{ session_count }}
{% #popover id="popover-sessions" %}
2024-08-08 12:47:51 +00:00
Number of sessions
2024-07-09 21:03:03 +00:00
{% /popover %}
</span>
<span data-popover-target="popover-average" class="flex gap-2 items-center">
2024-08-08 12:47:51 +00:00
<svg xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-6">
2024-07-09 21:03:03 +00:00
<path stroke-linecap="round" stroke-linejoin="round" d="M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z" />
</svg>
{{ session_average_without_manual }}
{% #popover id="popover-average" %}
2024-08-08 12:47:51 +00:00
Average playtime per session
2024-07-09 21:03:03 +00:00
{% /popover %}
</span>
2024-08-08 12:47:51 +00:00
<span data-popover-target="popover-playrange"
class="flex gap-2 items-center">
<svg xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-6">
2024-07-09 21:03:03 +00:00
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z" />
</svg>
{{ playrange }}
{% #popover id="popover-playrange" %}
2024-08-08 12:47:51 +00:00
Earliest and latest dates played
2024-07-09 21:03:03 +00:00
{% /popover %}
</span>
</div>
<div class="inline-flex rounded-md shadow-sm mb-3" role="group">
<a href="{% url 'edit_game' game.id %}">
2024-08-08 12:47:51 +00:00
<button type="button"
class="px-4 py-2 text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-s-lg hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white">
2024-08-04 20:40:43 +00:00
Edit
2024-07-09 21:03:03 +00:00
</button>
</a>
<a href="{% url 'delete_game' game.id %}">
2024-08-08 12:47:51 +00:00
<button type="button"
class="px-4 py-2 text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-e-lg hover:bg-red-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-red-700 dark:focus:ring-blue-500 dark:focus:text-white">
2024-08-04 20:40:43 +00:00
Delete
2024-07-09 21:03:03 +00:00
</button>
</a>
</div>
</div>
2024-08-19 19:58:43 +00:00
{% #h1 badge=edition_count %}Editions{% /h1 %}
<div class="mb-6">{% simple_table rows=edition_data.rows columns=edition_data.columns %}</div>
<div class="mb-6">
{% #h1 badge=purchase_count %}Purchases{% /h1 %}
{% simple_table rows=purchase_data.rows columns=purchase_data.columns %}
</div>
<div class="mb-6">
{% #h1 badge=session_count %}Sessions{% /h1 %}
{% simple_table rows=session_data.rows columns=session_data.columns page_obj=session_page_obj elided_page_range=session_elided_page_range %}
</div>
</div>
<script>
function getSessionCount() {
return document.getElementById('session-count').textContent.match("[0-9]+");
}
2024-08-19 19:58:43 +00:00
</script>
2023-10-01 19:28:02 +00:00
{% endblock content %}