{% extends "base.html" %} {% load static django_bootstrap5 %} {% block title %}Поиск{% endblock %} {% block extra_css %} {% endblock %} {% block content %}
{% include "includes/components/page_header.html" with icon="bi-search" title="Поиск" count=total count_label="Найдено:" search_id="globalSearch" search_placeholder="Фильтр по заголовкам" no_create=True has_filters=True filters_target="searchFilters" filters_template="search/_filters.html" %} {% if total > 0 %} {# ===== ПУБЛИКАЦИИ ===== #} {% if counts.post %}
Публикации
{% for item in results %} {% if item.model_name == 'post' %} {% with post=item.object %}
{{ post.title }}
{{ post.created_at|date:"d.m.Y H:i" }}
{% if post.body %}
{{ post.body|truncatewords:35 }}
{% endif %}
{% endwith %} {% endif %} {% endfor %}
{% endif %} {# ===== СОТРУДНИКИ ===== #} {% if counts.employee %}
Сотрудники
{% for item in results %} {% if item.model_name == 'employee' %} {% with emp=item.object %}
{% if emp.avatar %}{% else %}{% endif %}
{{ emp.last_name }} {{ emp.first_name }}{% if emp.patronymic %} {{ emp.patronymic }}{% endif %}
{% if emp.position %}{{ emp.position.name }} · {% endif %} {{ emp.email }}{% if emp.phone_number %} · {{ emp.phone_number }}{% endif %}
{% endwith %} {% endif %} {% endfor %}
{% endif %} {# ===== ОТДЕЛЫ ===== #} {% if counts.department %}
Отделы
{% for item in results %} {% if item.model_name == 'department' %} {% with dept=item.object %}
{{ dept.name }}
{% if dept.head %}Руководитель: {{ dept.head.last_name }} {{ dept.head.first_name }}{% if dept.head.patronymic %} {{ dept.head.patronymic }}{% endif %}{% endif %}
{% if dept.description %}
{{ dept.description|truncatewords:35 }}
{% endif %}
{% endwith %} {% endif %} {% endfor %}
{% endif %} {# ===== ЗАЯВЛЕНИЯ ===== #} {% if counts.request %}
Заявления
{% for item in results %} {% if item.model_name == 'request' %} {% with req=item.object %}
{% firstof req.title req.get_type_display "Заявление" %}
Автор: {{ req.employee }}{% if req.department %} · Отдел: {{ req.department }}{% endif %} · {{ req.created_at|date:"d.m.Y H:i" }}
{% if req.comment %}
{{ req.comment|truncatewords:35 }}
{% endif %}
{% if req.status == 'pending' %}На рассмотрении {% elif req.status == 'approved' %}Одобрено {% elif req.status == 'rejected' %}Отклонено {% elif req.status == 'cancelled' %}Отменено {% elif req.status == 'draft' %}Черновик {% endif %}
{% endwith %} {% endif %} {% endfor %}
{% endif %} {# ===== ЧАТЫ ===== #} {% if counts.chat %} {% endif %} {# ===== СООБЩЕНИЯ ===== #} {% if counts.message %}
Сообщения
{% for item in results %} {% if item.model_name == 'message' %} {% with msg=item.object %} {% firstof msg.chat.name msg.chat.department.name msg.chat.pk as msg_chat_label %} {% endwith %} {% endif %} {% endfor %}
{% endif %} {# ===== СОБЫТИЯ ===== #} {% if counts.event %}
События
{% for item in results %} {% if item.model_name == 'event' %} {% with ev=item.object %} {% firstof ev.title ev.name "Событие" as ev_title %}
{{ ev_title }}
{% if ev.start %}Начало: {{ ev.start|date:"d.m.Y H:i" }} {% elif ev.starts_at %}Начало: {{ ev.starts_at|date:"d.m.Y H:i" }}{% endif %} {% if ev.location %} · {{ ev.location }}{% endif %} {% if ev.department %} · {% firstof ev.department.name ev.department " " %}{% endif %}
{% endwith %} {% endif %} {% endfor %}
{% endif %} {% else %}
Ничего не найдено.
{% endif %}
{% endblock %}