Files
Арсентьев Александр 3a3e481750 feat: add photos to daily reports
2026-10-15 14:42:04 +03:00

84 lines
5.4 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<title>Daily Report {{ report.report_date.strftime('%d.%m.%Y') }} — {{ project.name }}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<main class="container py-4">
<nav class="mb-3"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="/projects/">Проекты</a></li><li class="breadcrumb-item"><a href="/projects/{{ project.id }}">{{ project.name }}</a></li><li class="breadcrumb-item"><a href="/projects/{{ project.id }}/daily-reports">Daily Reports</a></li><li class="breadcrumb-item active">{{ report.report_date.strftime('%d.%m.%Y') }}</li></ol></nav>
<div class="d-flex justify-content-between align-items-start mb-4 gap-3 flex-wrap">
<div>
<h1>Daily Report</h1>
<div class="text-muted">{{ report.report_date.strftime('%d.%m.%Y') }} · {{ system_names|join(', ') if system_names else 'Проектные позиции без системы' }}</div>
{% if report.notes %}<p class="mt-2">{{ report.notes }}</p>{% endif %}
</div>
<div class="d-flex gap-2">
<a class="btn btn-primary" href="/projects/{{ project.id }}/daily-reports/{{ report.id }}/edit">Редактировать</a>
{% if can_delete_report %}
<form method="post" action="/projects/{{ project.id }}/daily-reports/{{ report.id }}/delete" class="d-inline">
<button type="submit" class="btn btn-outline-danger"
onclick="return confirm('Удалить Daily Report? Действие необратимо.')">Удалить отчёт</button>
</form>
{% else %}
<button type="button" class="btn btn-outline-danger" disabled
title="{{ delete_blocked_reason }}">Удалить отчёт</button>
{% endif %}
</div>
</div>
{% if not can_delete_report %}
<div class="alert alert-warning" role="alert">{{ delete_blocked_reason }}</div>
{% endif %}
{% if warnings %}<div class="alert alert-warning"><strong>Превышен план по {{ warnings|length }} позициям.</strong> Фактическое выполнение сохранено.</div>{% endif %}
<div class="card"><div class="table-responsive"><table class="table table-hover align-middle mb-0">
<thead><tr><th>Раздел</th><th>№</th><th>Рабочая позиция</th><th>Ед.</th><th class="text-end">План</th><th class="text-end">В этом отчёте</th><th class="text-end">Закрыто КС-2</th><th class="text-end">Доступно</th></tr></thead>
<tbody>{% for row in rows %}
<tr class="{% if row.over_plan %}table-warning{% endif %}">
<td>{{ row.item.section.name if row.item.section else '—' }}<div class="small text-muted">{{ row.item.system.name if row.item.system else 'Без системы' }}</div></td>
<td>{{ row.item.source_number or '' }}</td>
<td>{{ row.item.name }}</td>
<td>{{ row.item.unit or '' }}</td>
<td class="text-end">{{ row.planned_quantity if row.planned_quantity is not none else '—' }}</td>
<td class="text-end">{{ row.current_quantity }}</td>
<td class="text-end">{{ row.closed_quantity }}</td>
<td class="text-end">{{ row.available_quantity }}</td>
</tr>
{% else %}<tr><td colspan="8" class="text-center text-muted py-4">В отчёте нет рабочих позиций.</td></tr>{% endfor %}</tbody>
</table></div></div>
<section class="card mt-4" id="photo-section">
<div class="card-header d-flex justify-content-between align-items-center">
<strong>Фотоотчёт</strong>
<span class="text-muted small">{{ photos|length }} фото</span>
</div>
<div class="card-body">
{% if photos %}
<div class="row g-2">
{% for photo in photos %}
<div class="col-6 col-md-3 col-lg-2">
<a href="/projects/{{ project.id }}/daily-reports/{{ report.id }}/photos/{{ photo.id }}"
target="_blank" rel="noopener" class="d-block">
<img class="img-fluid rounded border w-100"
style="aspect-ratio: 4 / 3; object-fit: cover;"
src="/projects/{{ project.id }}/daily-reports/{{ report.id }}/photos/{{ photo.id }}"
alt="{{ photo.original_name or ('Фото ' ~ photo.id) }}"
loading="lazy">
</a>
<div class="small text-muted text-truncate" title="{{ photo.original_name or '' }}">
{{ photo.original_name or ('Фото ' ~ photo.id) }}
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-muted">Фотографии не прикреплены. Их можно добавить при редактировании отчёта.</div>
{% endif %}
</div>
</section>
<div class="mt-3"><a href="/projects/{{ project.id }}/daily-reports" class="btn btn-outline-secondary">К списку отчётов</a></div>
</main>
</body>
</html>