bethaus-app/templates/file_access.html
2026-01-18 19:00:53 +00:00

120 lines
4.3 KiB
HTML

{# templates/file_access.html #}
{% extends 'base.html' %}
{# page title #}
{% block title %}Dateizugriffe{% endblock %}
{# page content #}
{% block content %}
<!-- Main Container -->
<div class="container">
<h2>Top 20 Dateizugriffe</h2>
<!-- Dropdown Controls -->
<div class="mb-4 d-flex flex-wrap gap-2">
<!-- Timeframe Dropdown -->
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle"
type="button" id="timeframeDropdown" data-bs-toggle="dropdown" aria-expanded="false">
{% if session['timeframe'] == 'last24hours' %}
Last 24 Hours
{% elif session['timeframe'] == '7days' %}
Last 7 Days
{% elif session['timeframe'] == '14days' %}
Last 14 Days
{% elif session['timeframe'] == '30days' %}
Last 30 Days
{% elif session['timeframe'] == '365days' %}
Last 365 Days
{% else %}
Select Timeframe
{% endif %}
</button>
<ul class="dropdown-menu" aria-labelledby="timeframeDropdown">
<li>
<a class="dropdown-item {% if session['timeframe'] == 'last24hours' %}active{% endif %}"
href="{{ url_for('file_access', timeframe='last24hours', category=selected_category) }}">
Last 24 Hours
</a>
</li>
<li>
<a class="dropdown-item {% if session['timeframe'] == '7days' %}active{% endif %}"
href="{{ url_for('file_access', timeframe='7days', category=selected_category) }}">
Last 7 Days
</a>
</li>
<li>
<a class="dropdown-item {% if session['timeframe'] == '14days' %}active{% endif %}"
href="{{ url_for('file_access', timeframe='14days', category=selected_category) }}">
Last 14 Days
</a>
</li>
<li>
<a class="dropdown-item {% if session['timeframe'] == '30days' %}active{% endif %}"
href="{{ url_for('file_access', timeframe='30days', category=selected_category) }}">
Last 30 Days
</a>
</li>
<li>
<a class="dropdown-item {% if session['timeframe'] == '365days' %}active{% endif %}"
href="{{ url_for('file_access', timeframe='365days', category=selected_category) }}">
Last 365 Days
</a>
</li>
</ul>
</div>
<!-- Category Dropdown -->
{% if categories %}
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle"
type="button" id="categoryDropdown" data-bs-toggle="dropdown" aria-expanded="false">
{{ selected_category_label }}
</button>
<ul class="dropdown-menu" aria-labelledby="categoryDropdown">
{% for option in categories %}
<li>
<a class="dropdown-item {% if selected_category == option.value %}active{% endif %}"
href="{{ url_for('file_access', timeframe=session['timeframe'], category=option.value) }}">
{{ option.label }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
<!-- Detailed Table of Top File Accesses -->
<div class="card mb-4">
<div class="card-header">{{ selected_category_label }}</div>
<div class="card-body">
{% if top20_files %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Access Count</th>
<th>File Path</th>
</tr>
</thead>
<tbody>
{% for row in top20_files %}
<tr>
<td>{{ row.access_count }}</td>
<td>{{ row.rel_path }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="mb-0">No data available for the selected timeframe and category.</p>
{% endif %}
</div>
</div>
</div>
{% endblock %}