Refactor report templates and styles
- Updated CSS styles in report.css for improved readability and consistency. - Removed deprecated report_class.html and report_group.html files. - Introduced new Jinja2 templates: report_class.jinja and report_group.jinja for better maintainability. - Enhanced JavaScript functionality in report_class.js to support dynamic chart rendering using Chart.js. - Updated report_group.js to streamline print functionality.
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{{ title }}</title>
|
||||
<style>
|
||||
{{ css_text | safe }}
|
||||
</style>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
<header class="header">
|
||||
<div class="title">
|
||||
<h1>{{ title }}</h1>
|
||||
<p>{{ hint }}</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn primary" onclick="printReport()">
|
||||
Печать / PDF
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="screen-nav" aria-label="Навигация по отчёту">
|
||||
<div class="section-nav">
|
||||
{% for section in report.sections %}
|
||||
<button
|
||||
type="button"
|
||||
class="nav-btn{% if section.id == report.active_section %} active{% endif %}"
|
||||
data-section="{{ section.id }}"
|
||||
>
|
||||
{{ section.title }}
|
||||
</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="class-nav">
|
||||
{% for section in report.sections %}
|
||||
<div
|
||||
class="class-nav-group{% if section.id == report.active_section %} active{% endif %}"
|
||||
data-section="{{ section.id }}"
|
||||
>
|
||||
{% for item in section.entries %}
|
||||
<button
|
||||
type="button"
|
||||
class="nav-btn class-btn{% if item.id == report.active_class %} active{% endif %}"
|
||||
data-section="{{ section.id }}"
|
||||
data-class-id="{{ item.id }}"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<nav class="print-nav" aria-label="Печатная навигация">
|
||||
<h2>Навигация</h2>
|
||||
{% for section in report.sections %}
|
||||
<section class="print-nav-section">
|
||||
<h3>{{ section.title }}</h3>
|
||||
<ul>
|
||||
{% for item in section.entries %}
|
||||
<li><a href="#class-{{ item.id }}">{{ item.label }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
|
||||
<div class="report-sections">
|
||||
{% for section in report.sections %}
|
||||
<section class="report-section" data-section="{{ section.id }}">
|
||||
{% for item in section.entries %}
|
||||
<article
|
||||
class="class-block{% if item.id == report.active_class %} active{% endif %}"
|
||||
id="class-{{ item.id }}"
|
||||
data-section="{{ section.id }}"
|
||||
data-class-id="{{ item.id }}"
|
||||
>
|
||||
<div class="class-head">
|
||||
<div>
|
||||
<div class="class-kicker">{{ section.title }}</div>
|
||||
<h3>{{ item.label }}</h3>
|
||||
{% if item.source_labels %}
|
||||
<div class="class-note">
|
||||
{{ item.source_labels | join(', ') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="class-chart">
|
||||
<canvas class="week-chart" data-chart-for="{{ item.id }}"></canvas>
|
||||
</div>
|
||||
<div class="class-table-wrap">
|
||||
<table class="class-table">
|
||||
<tbody>
|
||||
{% for week in item.weeks %}
|
||||
<tr>
|
||||
<td class="week-label">{{ week.long }}</td>
|
||||
<td class="num">{{ week.total_pairs }}</td>
|
||||
<td class="num">{{ week.conducted_display }}</td>
|
||||
<td class="num">{{ week.missed_display }}</td>
|
||||
<td class="num">{{ week.other_display }}</td>
|
||||
<td class="scheme-cell-wrap">
|
||||
{{ week.scheme_html | safe }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__CLASS_REPORT__ = {{ report_json | safe }};
|
||||
</script>
|
||||
<script>
|
||||
{{ js_text | safe }}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user