{% extends "base.html" %} {% load static %} {% block title %}Документы{% endblock %} {% block extra_css %} {% endblock %} {% block content %}
{# ===== НОВАЯ ШАПКА С КОМПОНЕНТОМ ===== #} {% if perms.documents.add_document %} {% include "includes/components/page_header.html" with icon="bi-file-earmark-text" title="Документы" no_search=True has_filters=True filters_target="docFilters" filters_template="documents/_filters.html" create_as_card=True create_modal="docCreateModal" create_text="Создать документ" %} {% else %} {% include "includes/components/page_header.html" with icon="bi-file-earmark-text" title="Документы" no_search=True has_filters=True filters_target="docFilters" filters_template="documents/_filters.html" create_as_card=True create_modal='' create_text="Создать документ" %} {% endif %} {# ===== Карточка со списком ===== #}
{% if documents %}
{% for doc in documents %}
{% if doc.file_url %} {# Для неознакомленных - через acknowledge URL, для ознакомленных - прямо на файл #} {% if doc.id not in acked_ids and scope == 'mine' %} {{ doc.title|default:"Без названия" }} {% else %} {{ doc.title|default:"Без названия" }} {% endif %} {% else %} {{ doc.title|default:"Без названия" }} {% endif %}
{{ doc.description|default:"— без описания —" }} {% if doc.uploaded_at %} • Загружен: {{ doc.uploaded_at|date:"d.m.Y H:i" }}{% endif %} {% if doc.sent_to_all %} • Для всех{% endif %}
{# Вкладка "Мои" — просто бейдж для ознакомленных #} {% if scope == 'mine' %} {% if doc.id in acked_ids %} ✓ Ознакомлен {% endif %} {# Вкладка "Все" — кнопка модалки #} {% else %} {% endif %} {% if show_admin_controls %} {% if perms.documents.change_document or user.is_staff or user.is_superuser %} {% endif %} {% if perms.documents.delete_document or user.is_staff or user.is_superuser %} {% endif %} {% endif %}
{% endfor %}
{% else %}
Нет доступных документов.
{% endif %}
{# ===== Пагинация ===== #} {% if prev_url or next_url or page > 1 %}
{% if prev_url %} Назад {% else %} Назад {% endif %} {% if next_url %} Вперёд {% else %} Вперёд {% endif %}
{% endif %}
{# ===== Модалка ведомости ознакомлений ===== #} {% endblock %} {% block extra_js %} {% endblock %}