{% load i18n %}
← {% trans "Все отчёты" %}
{% if reports_message %}
{{ reports_message }}
{% endif %} {% if reports_error %}
{{ reports_error }}
{% endif %} {% with report=report %}

{{ report.title }}

{% if show_live_report and report.period_from %} {% trans "Период" %}: {{ report.period_from }} – {{ report.period_to }} {% else %} {% trans "Месяц" %}: {{ report.id }} {% endif %} {% if report_is_published %} · {% trans "Опубликован" %} {% elif can_publish_report %} · {% trans "Черновик — виден только руководителю" %} {% endif %}

{% if can_publish_report %}

{% trans "Сформируйте Word, поправьте в редакторе, затем опубликуйте документ в «Документах отдела» — тогда отчёт увидит отдел." %}

{% endif %}
{% if can_publish_report %} {% if report_is_published %}
{% csrf_token %}
{% endif %} {% if can_prepare_word %}
{% csrf_token %}
{% endif %} {% endif %} {% if show_live_report %} {% trans "Скачать PDF" %} {% trans "Скачать Word" %} {% trans "Скачать Markdown" %} {% if can_manage_templates %} {% trans "Шаблон HTML-превью" %} {% endif %} {% endif %} {% if published_document %} {% trans "Скачать опубликованный Word" %} {% trans "Подписать КЕП" %} {% if kep_signature %} {% trans "Подписанный PDF" %} {% endif %} {% if show_live_report and onlyoffice_ready %} {% trans "Открыть Word" %} {% endif %} {% endif %}
{% if not show_live_report %}
{% if published_document %}

{% trans "Опубликованный файл отчёта:" %} {{ published_document.title }}

{% trans "Скачать Word" %} {% trans "Подписать КЕП" %} {% if kep_signature %} {% trans "Подписано КЕП" %} {% trans "Подписанный PDF" %} {% endif %}
{% else %}

{% trans "Опубликованный Word-файл для этого месяца пока не найден." %}

{% endif %}
{% else %}
{% trans "Всего работ" %}
{{ report.total_tasks }}
{% trans "Сотрудников" %}
{{ report.people_active }}
{% trans "Объектов" %}
{{ report.objects_count }}
{% trans "Направлений" %}
{{ report.summary|length }}

{% trans "Сводка по направлениям" %}

{% if report.summary %}
    {% for row in report.summary %}
  • {{ row.name }} {% if row.people %} — {{ row.people }}{% endif %} {{ row.count }}
  • {% endfor %}
{% else %}

{% trans "За выбранный месяц записей в журнале нет." %}

{% endif %}

{% trans "Объекты" %}

{% if report.pharmacies %}

{% trans "Аптеки" %}: {{ report.pharmacies|join:", " }}

{% endif %} {% if report.other_points %}

{% trans "Другие объекты" %}: {{ report.other_points|join:", " }}

{% endif %} {% if not report.pharmacies and not report.other_points %}

{% trans "Объекты не указаны." %}

{% endif %}
{% if report.conclusions %}

{% trans "Основные выводы и рекомендации" %}

{% for item in report.conclusions %}
{{ item.text }}
{% if item.bullets %}
    {% for bullet in item.bullets %}
  • {{ bullet }}
  • {% endfor %}
{% endif %}
{% endfor %}
{% endif %} {% for emp in report.employees %} {% if emp.tasks or emp.systems %}

{{ emp.name }}

{% if emp.role %}
{{ emp.role }}
{% endif %}
{{ emp.tasks_count }} {% trans "работ" %}{% if emp.systems_count %} · {{ emp.systems_count }} {% trans "систем" %}{% endif %}
{% if emp.systems %}
{% for sys in emp.systems %}
{{ sys.name }} — {{ sys.work }}
{% endfor %}
{% endif %} {% if emp.tasks %}
{% for task in emp.tasks %} {% endfor %}
{% trans "Дата" %} {% trans "Объект" %} {% trans "Работы" %}
{{ task.date }} {{ task.object|default:"—" }} {% if task.work_items|length > 1 %}
    {% for item in task.work_items %}
  • {{ item }}
  • {% endfor %}
{% else %} {{ task.work }} {% endif %} {% if task.ticket %} {{ task.ticket }}{% endif %}
{% endif %}
{% endif %} {% empty %}

{% trans "Нет данных для отчёта." %}

{% endfor %} {% endif %} {% endwith %}