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:
+1
-1
@@ -143,7 +143,7 @@ def create_default_pipeline(workspace_root: Path) -> Pipeline:
|
|||||||
pipeline.add_stage(Stage(
|
pipeline.add_stage(Stage(
|
||||||
name="Generate HTML Reports",
|
name="Generate HTML Reports",
|
||||||
description="Create standalone HTML reports for groups and classes",
|
description="Create standalone HTML reports for groups and classes",
|
||||||
module_name="stage_generate_reports_html"
|
module_name="stage_generate_reports_html_jinja"
|
||||||
))
|
))
|
||||||
|
|
||||||
return pipeline
|
return pipeline
|
||||||
|
|||||||
@@ -163,43 +163,58 @@ def _format_percent(value: int, total: int) -> str:
|
|||||||
return f"{value} ({round(value * 100 / total)}%)"
|
return f"{value} ({round(value * 100 / total)}%)"
|
||||||
|
|
||||||
|
|
||||||
def _build_week_chart(weeks: List[Dict[str, Any]]) -> str:
|
def _normalize_day_codes(day: Dict[str, Any]) -> List[str]:
|
||||||
if not weeks:
|
raw = day.get("codes")
|
||||||
return "<div class='muted'>Нет данных.</div>"
|
if raw is None:
|
||||||
|
raw = day.get("lessons", "")
|
||||||
|
codes = list(str(raw or ""))[:8]
|
||||||
|
while len(codes) < 8:
|
||||||
|
codes.append("0")
|
||||||
|
return codes
|
||||||
|
|
||||||
width = max(720, len(weeks) * 92)
|
|
||||||
height = 280
|
|
||||||
bar_width = 42
|
|
||||||
max_value = max(
|
|
||||||
max(int(w.get("conducted", 0)), int(w.get("missed", 0)), int(w.get("other", 0)))
|
|
||||||
for w in weeks
|
|
||||||
) or 1
|
|
||||||
|
|
||||||
def bar_height(value: int) -> int:
|
def _normalize_week_data(week: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
return max(2, round((value / max_value) * 180)) if value else 0
|
normalized_days: List[Dict[str, Any]] = []
|
||||||
|
for day in week.get("days", []) or []:
|
||||||
|
normalized_days.append(
|
||||||
|
{
|
||||||
|
"date": day.get("date"),
|
||||||
|
"weekday": day.get("weekday"),
|
||||||
|
"codes": _normalize_day_codes(day),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
pieces = [
|
code_counts = {"0": 0, "1": 0, "2": 0, "3": 0}
|
||||||
f"<svg class='week-chart' viewBox='0 0 {width} {height}' preserveAspectRatio='xMinYMin meet'>"
|
for code, count in (week.get("code_counts", {}) or {}).items():
|
||||||
]
|
key = str(code)
|
||||||
baseline = 210
|
if key in code_counts:
|
||||||
for index, week in enumerate(weeks):
|
code_counts[key] += int(count)
|
||||||
x = 70 + index * 92
|
|
||||||
current_bottom = baseline
|
if sum(code_counts.values()) == 0 and normalized_days:
|
||||||
pieces.append(
|
for day in normalized_days:
|
||||||
f"<text class='chart-week-label' x='{x + bar_width / 2}' y='{baseline + 28}' text-anchor='middle'>{week.get('short')}</text>"
|
for code in day["codes"]:
|
||||||
)
|
if code not in code_counts:
|
||||||
for cls_name, value in [("code-1", int(week.get("missed", 0))), ("code-2", int(week.get("other", 0))), ("code-3", int(week.get("conducted", 0)))]:
|
code_counts[code] = 0
|
||||||
h = bar_height(value)
|
code_counts[code] += 1
|
||||||
if h:
|
|
||||||
pieces.append(
|
total_pairs = int(week.get("total_pairs", 0))
|
||||||
f"<rect class='week-bar {cls_name}' x='{x}' y='{current_bottom - h}' width='{bar_width}' height='{h}' rx='5'></rect>"
|
if total_pairs <= 0:
|
||||||
)
|
total_pairs = sum(int(v) for v in code_counts.values())
|
||||||
current_bottom -= h
|
|
||||||
pieces.append(
|
conducted = int(week.get("conducted", code_counts.get("3", 0)))
|
||||||
f"<text class='chart-count' x='{x + bar_width / 2}' y='{current_bottom - 8}' text-anchor='middle'>{int(week.get('total_pairs', 0))}</text>"
|
missed = int(week.get("missed", code_counts.get("1", 0)))
|
||||||
)
|
other = int(week.get("other", code_counts.get("2", 0)))
|
||||||
pieces.append("</svg>")
|
|
||||||
return "".join(pieces)
|
return {
|
||||||
|
**week,
|
||||||
|
"days": normalized_days,
|
||||||
|
"daily_summary": ["".join(day["codes"]) for day in normalized_days],
|
||||||
|
"code_counts": code_counts,
|
||||||
|
"total_pairs": total_pairs,
|
||||||
|
"conducted": conducted,
|
||||||
|
"missed": missed,
|
||||||
|
"other": other,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _build_scheme_table(week: Dict[str, Any]) -> str:
|
def _build_scheme_table(week: Dict[str, Any]) -> str:
|
||||||
@@ -215,16 +230,15 @@ def _build_scheme_table(week: Dict[str, Any]) -> str:
|
|||||||
rows.append(f"<tr><th>{day.get('weekday')}</th>{cells}</tr>")
|
rows.append(f"<tr><th>{day.get('weekday')}</th>{cells}</tr>")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
"<table class='scheme-table'><thead><tr><th>День</th>"
|
"<table class='scheme-table'><tbody>"
|
||||||
+ "".join(f"<th>{i}</th>" for i in range(1, 9))
|
|
||||||
+ "</tr></thead><tbody>"
|
|
||||||
+ "".join(rows)
|
+ "".join(rows)
|
||||||
+ "</tbody></table>"
|
+ "</tbody></table>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _build_class_block(item: Dict[str, Any]) -> Dict[str, Any]:
|
def _build_class_block(item: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
weeks = item.get("weeks", []) or []
|
raw_weeks = item.get("weeks", []) or []
|
||||||
|
weeks = [_normalize_week_data(week) for week in raw_weeks]
|
||||||
for week in weeks:
|
for week in weeks:
|
||||||
total = int(week.get("total_pairs", 0))
|
total = int(week.get("total_pairs", 0))
|
||||||
week["conducted_display"] = _format_percent(int(week.get("conducted", 0)), total)
|
week["conducted_display"] = _format_percent(int(week.get("conducted", 0)), total)
|
||||||
@@ -233,7 +247,12 @@ def _build_class_block(item: Dict[str, Any]) -> Dict[str, Any]:
|
|||||||
week["scheme_html"] = _build_scheme_table(week)
|
week["scheme_html"] = _build_scheme_table(week)
|
||||||
|
|
||||||
item["weeks"] = weeks
|
item["weeks"] = weeks
|
||||||
item["chart_svg"] = _build_week_chart(weeks)
|
item["chart_data"] = {
|
||||||
|
"labels": [str(week.get("short") or week.get("long") or "") for week in weeks],
|
||||||
|
"missed": [int(week.get("missed", 0)) for week in weeks],
|
||||||
|
"other": [int(week.get("other", 0)) for week in weeks],
|
||||||
|
"conducted": [int(week.get("conducted", 0)) for week in weeks],
|
||||||
|
}
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
@@ -270,18 +289,18 @@ def _build_class_report_model(workspace_root: Path, context: Dict[str, Any] | No
|
|||||||
|
|
||||||
sections: List[Dict[str, Any]] = []
|
sections: List[Dict[str, Any]] = []
|
||||||
for part in ordered_parts:
|
for part in ordered_parts:
|
||||||
section_items: List[Dict[str, Any]] = []
|
entries: List[Dict[str, Any]] = []
|
||||||
|
|
||||||
if part == "Факультеты":
|
if part == "Факультеты":
|
||||||
faculty_sources = [raw_by_id[g] for g in ["fe", "kl", "km", "lv", "mk", "mu"] if g in raw_by_id]
|
faculty_sources = [raw_by_id[g] for g in ["fe", "kl", "km", "lv", "mk", "mu"] if g in raw_by_id]
|
||||||
if faculty_sources:
|
if faculty_sources:
|
||||||
section_items.append(_aggregate_item(faculty_sources, "before_804", "до 8.04", part))
|
entries.append(_aggregate_item(faculty_sources, "before_804", "до 8.04", part))
|
||||||
|
|
||||||
for raw in raw_items:
|
for raw in raw_items:
|
||||||
group_id = str(raw.get("group_id") or "")
|
group_id = str(raw.get("group_id") or "")
|
||||||
if _part_name(classes_df, group_id) != part:
|
if _part_name(classes_df, group_id) != part:
|
||||||
continue
|
continue
|
||||||
section_items.append(
|
entries.append(
|
||||||
_build_class_block(
|
_build_class_block(
|
||||||
{
|
{
|
||||||
"id": group_id,
|
"id": group_id,
|
||||||
@@ -296,12 +315,12 @@ def _build_class_report_model(workspace_root: Path, context: Dict[str, Any] | No
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
section_items.sort(key=lambda item: (0 if item.get("is_aggregate") else 1, item.get("order", 9999), item.get("label", "")))
|
entries.sort(key=lambda item: (0 if item.get("is_aggregate") else 1, item.get("order", 9999), item.get("label", "")))
|
||||||
if section_items:
|
if entries:
|
||||||
sections.append({"id": part, "title": part, "items": section_items})
|
sections.append({"id": part, "title": part, "entries": entries})
|
||||||
|
|
||||||
active_section = sections[0]["id"] if sections else ""
|
active_section = sections[0]["id"] if sections else ""
|
||||||
active_class = sections[0]["items"][0]["id"] if sections and sections[0]["items"] else ""
|
active_class = sections[0]["entries"][0]["id"] if sections and sections[0]["entries"] else ""
|
||||||
|
|
||||||
report = {
|
report = {
|
||||||
"title": "Отчёт по классам",
|
"title": "Отчёт по классам",
|
||||||
@@ -341,8 +360,8 @@ def run_stage(workspace_root: Path, context: Dict[str, Any] | None = None) -> Di
|
|||||||
"""Generate standalone HTML reports from Jinja templates."""
|
"""Generate standalone HTML reports from Jinja templates."""
|
||||||
template_dir = workspace_root / "template"
|
template_dir = workspace_root / "template"
|
||||||
required = [
|
required = [
|
||||||
template_dir / "report_class.html",
|
template_dir / "report_class.jinja",
|
||||||
template_dir / "report_group.html",
|
template_dir / "report_group.jinja",
|
||||||
template_dir / "report.css",
|
template_dir / "report.css",
|
||||||
template_dir / "report_class.js",
|
template_dir / "report_class.js",
|
||||||
template_dir / "report_group.js",
|
template_dir / "report_group.js",
|
||||||
@@ -359,7 +378,7 @@ def run_stage(workspace_root: Path, context: Dict[str, Any] | None = None) -> Di
|
|||||||
group_report = _build_group_report_model(workspace_root)
|
group_report = _build_group_report_model(workspace_root)
|
||||||
|
|
||||||
class_html = _render_jinja(
|
class_html = _render_jinja(
|
||||||
template_dir / "report_class.html",
|
template_dir / "report_class.jinja",
|
||||||
{
|
{
|
||||||
"title": class_report["title"],
|
"title": class_report["title"],
|
||||||
"hint": f"Период: {class_report['period']['start']} — {class_report['period']['end']}",
|
"hint": f"Период: {class_report['period']['start']} — {class_report['period']['end']}",
|
||||||
@@ -370,7 +389,7 @@ def run_stage(workspace_root: Path, context: Dict[str, Any] | None = None) -> Di
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
group_html = _render_jinja(
|
group_html = _render_jinja(
|
||||||
template_dir / "report_group.html",
|
template_dir / "report_group.jinja",
|
||||||
{
|
{
|
||||||
"title": group_report["title"],
|
"title": group_report["title"],
|
||||||
"hint": group_report["note"],
|
"hint": group_report["note"],
|
||||||
@@ -386,7 +405,7 @@ def run_stage(workspace_root: Path, context: Dict[str, Any] | None = None) -> Di
|
|||||||
out_group.write_text(group_html, encoding="utf-8")
|
out_group.write_text(group_html, encoding="utf-8")
|
||||||
out_class.write_text(class_html, encoding="utf-8")
|
out_class.write_text(class_html, encoding="utf-8")
|
||||||
|
|
||||||
print("✓ HTML reports generated")
|
print("[OK] HTML reports generated")
|
||||||
print(f" - {out_group.name}")
|
print(f" - {out_group.name}")
|
||||||
print(f" - {out_class.name}")
|
print(f" - {out_class.name}")
|
||||||
|
|
||||||
|
|||||||
+107
-217
@@ -14,10 +14,18 @@
|
|||||||
--empty: #e5e7eb;
|
--empty: #e5e7eb;
|
||||||
}
|
}
|
||||||
|
|
||||||
* { box-sizing: border-box; }
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
font-family:
|
||||||
|
Inter,
|
||||||
|
system-ui,
|
||||||
|
-apple-system,
|
||||||
|
BlinkMacSystemFont,
|
||||||
|
"Segoe UI",
|
||||||
|
sans-serif;
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
}
|
}
|
||||||
@@ -112,7 +120,9 @@ body {
|
|||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.muted { color: var(--muted); }
|
.muted {
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
.screen-nav {
|
.screen-nav {
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
@@ -130,8 +140,12 @@ body {
|
|||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.class-nav-group { display: none; }
|
.class-nav-group {
|
||||||
.class-nav-group.active { display: flex; }
|
display: none;
|
||||||
|
}
|
||||||
|
.class-nav-group.active {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.nav-btn {
|
.nav-btn {
|
||||||
border: 1px solid var(--line);
|
border: 1px solid var(--line);
|
||||||
@@ -143,7 +157,9 @@ body {
|
|||||||
transition: 0.15s ease;
|
transition: 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-btn:hover { border-color: var(--accent); }
|
.nav-btn:hover {
|
||||||
|
border-color: var(--accent);
|
||||||
|
}
|
||||||
.nav-btn.active {
|
.nav-btn.active {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
@@ -156,11 +172,20 @@ body {
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.print-nav-section + .print-nav-section { margin-top: 14px; }
|
.print-nav-section + .print-nav-section {
|
||||||
.print-nav-section h3 { margin: 0 0 8px; }
|
margin-top: 14px;
|
||||||
.print-nav-section ul { margin: 0; padding-left: 18px; }
|
}
|
||||||
|
.print-nav-section h3 {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
}
|
||||||
|
.print-nav-section ul {
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
.report-section { margin-bottom: 26px; }
|
.report-section {
|
||||||
|
margin-bottom: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
.class-block {
|
.class-block {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -168,7 +193,9 @@ body {
|
|||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.class-block.active { display: block; }
|
.class-block.active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.class-head {
|
.class-head {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -198,31 +225,16 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.class-chart {
|
.class-chart {
|
||||||
overflow-x: auto;
|
position: relative;
|
||||||
|
min-height: 320px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.week-chart {
|
.week-chart {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: 320px;
|
||||||
min-width: 720px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart-week-label {
|
|
||||||
font-size: 12px;
|
|
||||||
fill: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart-count {
|
|
||||||
font-size: 12px;
|
|
||||||
fill: var(--text);
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.week-bar.code-1 { fill: var(--bad); }
|
|
||||||
.week-bar.code-2 { fill: var(--warn); }
|
|
||||||
.week-bar.code-3 { fill: var(--good); }
|
|
||||||
|
|
||||||
.class-table,
|
.class-table,
|
||||||
.scheme-table,
|
.scheme-table,
|
||||||
.table {
|
.table {
|
||||||
@@ -252,10 +264,16 @@ body {
|
|||||||
background: #f8fafc;
|
background: #f8fafc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.week-label { white-space: nowrap; }
|
.week-label {
|
||||||
.num { white-space: nowrap; }
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.num {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.scheme-cell-wrap { min-width: 420px; }
|
.scheme-cell-wrap {
|
||||||
|
min-width: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
.scheme-table {
|
.scheme-table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -286,154 +304,43 @@ body {
|
|||||||
border: 1px solid rgba(0, 0, 0, 0.06);
|
border: 1px solid rgba(0, 0, 0, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.scheme-cell.code-0 { background: var(--empty); }
|
.scheme-cell.code-0 {
|
||||||
.scheme-cell.code-1 { background: var(--bad); }
|
background: var(--empty);
|
||||||
.scheme-cell.code-2 { background: var(--warn); }
|
|
||||||
.scheme-cell.code-3 { background: var(--good); }
|
|
||||||
|
|
||||||
.code-1 { color: var(--bad); }
|
|
||||||
.code-2 { color: var(--warn); }
|
|
||||||
.code-3 { color: var(--good); }
|
|
||||||
|
|
||||||
@media print {
|
|
||||||
body { background: #fff; }
|
|
||||||
.page { max-width: none; padding: 0; }
|
|
||||||
.screen-nav,
|
|
||||||
.actions { display: none !important; }
|
|
||||||
.print-nav { display: block; }
|
|
||||||
.class-block { display: block !important; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
|
|
||||||
.section, .class-block, .print-nav { box-shadow: none; }
|
|
||||||
.table th, .class-table th { position: static; }
|
|
||||||
}
|
}
|
||||||
:root {
|
.scheme-cell.code-1 {
|
||||||
color-scheme: light;
|
background: var(--bad);
|
||||||
--bg: #f7f8fb;
|
}
|
||||||
--panel: #ffffff;
|
.scheme-cell.code-2 {
|
||||||
--text: #1b1f2a;
|
background: var(--warn);
|
||||||
--muted: #667085;
|
}
|
||||||
--line: #d9e0ea;
|
.scheme-cell.code-3 {
|
||||||
--accent: #2563eb;
|
background: var(--good);
|
||||||
--accent-2: #0f766e;
|
|
||||||
--shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
* { box-sizing: border-box; }
|
.code-1 {
|
||||||
body {
|
color: var(--bad);
|
||||||
margin: 0;
|
}
|
||||||
font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
.code-2 {
|
||||||
color: var(--text);
|
color: var(--warn);
|
||||||
background: var(--bg);
|
}
|
||||||
|
.code-3 {
|
||||||
|
color: var(--good);
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
.note {
|
||||||
max-width: 1400px;
|
padding: 14px 16px;
|
||||||
margin: 0 auto;
|
border-left: 4px solid var(--accent);
|
||||||
padding: 24px;
|
background: #eff6ff;
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 16px;
|
|
||||||
align-items: flex-start;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title h1 {
|
|
||||||
margin: 0 0 8px;
|
|
||||||
font-size: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title p {
|
|
||||||
margin: 0;
|
|
||||||
color: var(--muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 12px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
border: 1px solid var(--line);
|
|
||||||
background: var(--panel);
|
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 10px 14px;
|
margin-bottom: 18px;
|
||||||
cursor: pointer;
|
|
||||||
box-shadow: var(--shadow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn.primary {
|
.grid-2 {
|
||||||
background: linear-gradient(135deg, var(--accent), #4f46e5);
|
|
||||||
color: white;
|
|
||||||
border-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section {
|
|
||||||
background: var(--panel);
|
|
||||||
border: 1px solid var(--line);
|
|
||||||
border-radius: 18px;
|
|
||||||
padding: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
box-shadow: var(--shadow);
|
|
||||||
}
|
|
||||||
|
|
||||||
.section h2 {
|
|
||||||
margin: 0 0 16px;
|
|
||||||
font-size: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cards {
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
grid-template-columns: 1.3fr 1fr;
|
||||||
gap: 14px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
|
||||||
border: 1px solid var(--line);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 16px;
|
|
||||||
background: linear-gradient(180deg, #fff, #fbfcff);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-value {
|
|
||||||
font-size: 26px;
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 1.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-label {
|
|
||||||
color: var(--muted);
|
|
||||||
margin-top: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table th,
|
|
||||||
.table td {
|
|
||||||
border-bottom: 1px solid var(--line);
|
|
||||||
padding: 10px 12px;
|
|
||||||
vertical-align: top;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table th {
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--muted);
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.04em;
|
|
||||||
background: #f8fafc;
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.muted { color: var(--muted); }
|
|
||||||
|
|
||||||
.pill {
|
.pill {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
@@ -444,55 +351,38 @@ body {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-2 {
|
.nowrap {
|
||||||
display: grid;
|
white-space: nowrap;
|
||||||
grid-template-columns: 1.3fr 1fr;
|
|
||||||
gap: 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart-wrap {
|
|
||||||
min-height: 80px;
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bar-chart {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
overflow: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart-label {
|
|
||||||
font-size: 12px;
|
|
||||||
fill: #1b1f2a;
|
|
||||||
dominant-baseline: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart-value {
|
|
||||||
font-size: 12px;
|
|
||||||
fill: #334155;
|
|
||||||
dominant-baseline: middle;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart-track { fill: #e8edf5; }
|
|
||||||
.chart-bar { fill: var(--accent); }
|
|
||||||
.chart-bar.secondary { fill: var(--accent-2); }
|
|
||||||
|
|
||||||
.note {
|
|
||||||
padding: 14px 16px;
|
|
||||||
border-left: 4px solid var(--accent);
|
|
||||||
background: #eff6ff;
|
|
||||||
border-radius: 12px;
|
|
||||||
margin-bottom: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nowrap { white-space: nowrap; }
|
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
body { background: white; }
|
body {
|
||||||
.page { max-width: none; padding: 0; }
|
background: #fff;
|
||||||
.actions { display: none; }
|
}
|
||||||
.section, .card { box-shadow: none; }
|
.page {
|
||||||
.section { break-inside: avoid; }
|
max-width: none;
|
||||||
.table th { position: static; }
|
padding: 0;
|
||||||
|
}
|
||||||
|
.screen-nav,
|
||||||
|
.actions {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
.print-nav {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.class-block {
|
||||||
|
display: block !important;
|
||||||
|
box-shadow: none;
|
||||||
|
break-inside: avoid;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
.section,
|
||||||
|
.class-block,
|
||||||
|
.print-nav {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.table th,
|
||||||
|
.class-table th {
|
||||||
|
position: static;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
<!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>
|
|
||||||
</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.items %}
|
|
||||||
<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.items %}
|
|
||||||
<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.items %}
|
|
||||||
<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">
|
|
||||||
{{ item.chart_svg | safe }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="class-table-wrap">
|
|
||||||
<table class="class-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Неделя</th>
|
|
||||||
<th>Всего пар</th>
|
|
||||||
<th>Пар проведено</th>
|
|
||||||
<th>Пар пропущено</th>
|
|
||||||
<th>Иные пары</th>
|
|
||||||
<th>Схема</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<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>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang='ru'>
|
|
||||||
<head>
|
|
||||||
<meta charset='utf-8'>
|
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
|
||||||
<title>{{TITLE}}</title>
|
|
||||||
{{STYLE_TAG}}
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class='page'>
|
|
||||||
<div class='header'>
|
|
||||||
<div class='title'>
|
|
||||||
<h1>{{TITLE}}</h1>
|
|
||||||
<p>{{HINT}}</p>
|
|
||||||
</div>
|
|
||||||
<div class='actions'>
|
|
||||||
<button class='btn primary' onclick='printReport()'>Печать / PDF</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{CONTENT}}
|
|
||||||
</div>
|
|
||||||
{{SCRIPT_TAG}}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -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>
|
||||||
+120
-25
@@ -1,4 +1,6 @@
|
|||||||
(function () {
|
(function () {
|
||||||
|
const chartStore = new Map();
|
||||||
|
|
||||||
function qs(selector, root) {
|
function qs(selector, root) {
|
||||||
return (root || document).querySelector(selector);
|
return (root || document).querySelector(selector);
|
||||||
}
|
}
|
||||||
@@ -7,54 +9,150 @@
|
|||||||
return Array.from((root || document).querySelectorAll(selector));
|
return Array.from((root || document).querySelectorAll(selector));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setActiveSection(sectionId) {
|
function buildChartForClass(classId, report) {
|
||||||
qsa('.section-nav .nav-btn[data-section]').forEach((btn) => {
|
if (!classId || chartStore.has(classId) || typeof Chart === "undefined") {
|
||||||
btn.classList.toggle('active', btn.dataset.section === sectionId);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sections = Array.isArray(report.sections) ? report.sections : [];
|
||||||
|
const entry = sections
|
||||||
|
.flatMap((section) => section.entries || [])
|
||||||
|
.find((item) => item.id === classId);
|
||||||
|
if (!entry) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const canvas = qs(`.week-chart[data-chart-for="${classId}"]`);
|
||||||
|
if (!canvas) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const chartData = entry.chart_data || {};
|
||||||
|
const labels = Array.isArray(chartData.labels) ? chartData.labels : [];
|
||||||
|
const missed = Array.isArray(chartData.missed) ? chartData.missed : [];
|
||||||
|
const other = Array.isArray(chartData.other) ? chartData.other : [];
|
||||||
|
const conducted = Array.isArray(chartData.conducted)
|
||||||
|
? chartData.conducted
|
||||||
|
: [];
|
||||||
|
|
||||||
|
if (!labels.length) {
|
||||||
|
const container = canvas.parentElement;
|
||||||
|
if (container) {
|
||||||
|
container.innerHTML = "<div class='muted'>Нет данных.</div>";
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const chart = new Chart(canvas, {
|
||||||
|
type: "bar",
|
||||||
|
data: {
|
||||||
|
labels,
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
label: "Пропущено",
|
||||||
|
data: missed,
|
||||||
|
backgroundColor: "#ef4444",
|
||||||
|
stack: "pairs",
|
||||||
|
borderRadius: 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Иное",
|
||||||
|
data: other,
|
||||||
|
backgroundColor: "#f59e0b",
|
||||||
|
stack: "pairs",
|
||||||
|
borderRadius: 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Проведено",
|
||||||
|
data: conducted,
|
||||||
|
backgroundColor: "#22c55e",
|
||||||
|
stack: "pairs",
|
||||||
|
borderRadius: 4,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
maintainAspectRatio: false,
|
||||||
|
interaction: {
|
||||||
|
mode: "index",
|
||||||
|
intersect: false,
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
x: {
|
||||||
|
stacked: true,
|
||||||
|
grid: {
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
y: {
|
||||||
|
stacked: true,
|
||||||
|
beginAtZero: true,
|
||||||
|
ticks: {
|
||||||
|
precision: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
qsa('.class-nav-group').forEach((group) => {
|
chartStore.set(classId, chart);
|
||||||
group.classList.toggle('active', group.dataset.section === sectionId);
|
}
|
||||||
|
|
||||||
|
function setActiveSection(sectionId, report) {
|
||||||
|
qsa(".section-nav .nav-btn[data-section]").forEach((btn) => {
|
||||||
|
btn.classList.toggle("active", btn.dataset.section === sectionId);
|
||||||
|
});
|
||||||
|
|
||||||
|
qsa(".class-nav-group").forEach((group) => {
|
||||||
|
group.classList.toggle("active", group.dataset.section === sectionId);
|
||||||
});
|
});
|
||||||
|
|
||||||
const firstButton = qs(`.class-nav-group.active .class-btn[data-class-id]`);
|
const firstButton = qs(`.class-nav-group.active .class-btn[data-class-id]`);
|
||||||
if (firstButton) {
|
if (firstButton) {
|
||||||
setActiveClass(firstButton.dataset.classId, false);
|
setActiveClass(firstButton.dataset.classId, false, report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setActiveClass(classId, scrollIntoView) {
|
function setActiveClass(classId, scrollIntoView, report) {
|
||||||
qsa('.class-btn[data-class-id]').forEach((btn) => {
|
qsa(".class-btn[data-class-id]").forEach((btn) => {
|
||||||
btn.classList.toggle('active', btn.dataset.classId === classId);
|
btn.classList.toggle("active", btn.dataset.classId === classId);
|
||||||
});
|
});
|
||||||
|
|
||||||
qsa('.class-block[data-class-id]').forEach((block) => {
|
qsa(".class-block[data-class-id]").forEach((block) => {
|
||||||
const active = block.dataset.classId === classId;
|
const active = block.dataset.classId === classId;
|
||||||
block.classList.toggle('active', active);
|
block.classList.toggle("active", active);
|
||||||
if (active && scrollIntoView) {
|
if (active && scrollIntoView) {
|
||||||
block.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
block.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
buildChartForClass(classId, report);
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
const report = window.__CLASS_REPORT__ || {};
|
const report = window.__CLASS_REPORT__ || {};
|
||||||
const activeSection = report.active_section || '';
|
const activeSection = report.active_section || "";
|
||||||
const activeClass = report.active_class || '';
|
const activeClass = report.active_class || "";
|
||||||
|
|
||||||
qsa('.section-nav .nav-btn[data-section]').forEach((btn) => {
|
qsa(".section-nav .nav-btn[data-section]").forEach((btn) => {
|
||||||
btn.addEventListener('click', () => setActiveSection(btn.dataset.section));
|
btn.addEventListener("click", () =>
|
||||||
|
setActiveSection(btn.dataset.section, report),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
qsa('.class-btn[data-class-id]').forEach((btn) => {
|
qsa(".class-btn[data-class-id]").forEach((btn) => {
|
||||||
btn.addEventListener('click', () => setActiveClass(btn.dataset.classId, true));
|
btn.addEventListener("click", () =>
|
||||||
|
setActiveClass(btn.dataset.classId, true, report),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (activeSection) {
|
if (activeSection) {
|
||||||
setActiveSection(activeSection);
|
setActiveSection(activeSection, report);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeClass) {
|
if (activeClass) {
|
||||||
setActiveClass(activeClass, false);
|
setActiveClass(activeClass, false, report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,12 +160,9 @@
|
|||||||
window.print();
|
window.print();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === "loading") {
|
||||||
document.addEventListener('DOMContentLoaded', init);
|
document.addEventListener("DOMContentLoaded", init);
|
||||||
} else {
|
} else {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
function printReport() {
|
|
||||||
window.print();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
<!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>
|
|
||||||
</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="section">
|
|
||||||
<h2>Шаблон пар</h2>
|
|
||||||
{% if report.lesson_windows %}
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr><th>Пара</th><th>Начало</th><th>Окончание</th></tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for item in report.lesson_windows %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ item.lesson }}</td>
|
|
||||||
<td>{{ item.start }}</td>
|
|
||||||
<td>{{ item.end }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<div class="muted">Нет данных.</div>
|
|
||||||
{% endif %}
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
window.__GROUP_REPORT__ = {{ report_json | safe }};
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
{{ js_text | safe }}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang='ru'>
|
|
||||||
<head>
|
|
||||||
<meta charset='utf-8'>
|
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
|
||||||
<title>{{TITLE}}</title>
|
|
||||||
{{STYLE_TAG}}
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class='page'>
|
|
||||||
<div class='header'>
|
|
||||||
<div class='title'>
|
|
||||||
<h1>{{TITLE}}</h1>
|
|
||||||
<p>{{HINT}}</p>
|
|
||||||
</div>
|
|
||||||
<div class='actions'>
|
|
||||||
<button class='btn primary' onclick='printReport()'>Печать / PDF</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{CONTENT}}
|
|
||||||
</div>
|
|
||||||
{{SCRIPT_TAG}}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<!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>
|
||||||
|
</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="section">
|
||||||
|
<h2>Шаблон пар</h2>
|
||||||
|
{% if report.lesson_windows %}
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr><th>Пара</th><th>Начало</th><th>Окончание</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for item in report.lesson_windows %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ item.lesson }}</td>
|
||||||
|
<td>{{ item.start }}</td>
|
||||||
|
<td>{{ item.end }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<div class="muted">Нет данных.</div>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>window.__GROUP_REPORT__ = {{ report_json | safe }};</script>
|
||||||
|
<script>{{ js_text | safe }}</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
window.printReport = function printReport() {
|
window.printReport = function printReport() {
|
||||||
window.print();
|
window.print();
|
||||||
};
|
};
|
||||||
function printReport() {
|
|
||||||
window.print();
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user