{# templates/employees/employee_detail.html #} {% extends "base.html" %} {% load static django_bootstrap5 %} {% block title %} {% if is_me %}Мой профиль{% else %}Профиль сотрудника{% endif %} {% endblock %} {% block extra_css %} {% endblock %} {% block content %}

{% if is_me %}Мой профиль{% else %}Профиль сотрудника{% endif %}

{% if emp.avatar %} Аватар {{ emp.last_name }} {{ emp.first_name }} {% else %}
{% firstof emp.first_name emp.last_name "?" as initial %} {{ initial|slice:":1"|upper }}
{% endif %}
{{ emp.last_name }} {{ emp.first_name }}{% if emp.patronymic %} {{ emp.patronymic }}{% endif %}
{% if can_edit %} {% endif %}
{% if emp.position.name %} {{ emp.position.name }} {% elif emp.position_label %} {{ emp.position_label }} {% elif emp.position %} Должность #{{ emp.position }} {% endif %}
{% if emp.email %} {% endif %} {% if emp.phone_number %} {% endif %} {% if emp.telegram %}
Telegram: {{ emp.telegram }}
{% endif %} {% if emp.whatsapp %}
WhatsApp: {{ emp.whatsapp }}
{% endif %} {% if emp.wechat %}
WeChat: {{ emp.wechat }}
{% endif %} {% if not emp.email and not emp.phone_number and not emp.telegram and not emp.whatsapp and not emp.wechat %}
Контакты не указаны
{% endif %}
{# === ОТДЕЛЫ: роль скрыта; редактор по кнопке-карандашу (только для начальников) === #}
{% if emp_depts and emp_depts|length %} {% for d in emp_depts %} {% if d.name %}
{% if d.id %} {{ d.name }} {% else %} {{ d.name }} {% endif %} {% if d.role_name %}— {{ d.role_name }}{% endif %}
{% if d.is_head %} Руководитель {% endif %} {% if d.can_edit_role %} {% endif %}
{% if d.can_edit_role %}
{% csrf_token %}
{% endif %}
{% endif %} {% endfor %} {% else %}
Отделы не указаны
{% endif %}
{# === КАДРОВЫЕ СОБЫТИЯ (для аутентифицированных) === #} {% if request.user.is_authenticated %} {% with acts_src=employee_actions|default:emp.actions %} {% with acts=acts_src.results|default:acts_src %} {% if acts %}
{% for a in acts %}
{% firstof a.action_display a.action %}
{% if a.comment %}
{{ a.comment }}
{% endif %}
{% if a.extra %}
{% for k, v in a.extra.items %}
{{ k }}: {{ v }}
{% endfor %}
{% endif %} {% if a.history and a.history|length %}
История
{% for h in a.history %} {% with new_action=h.changes.action.new|default:a.action %}
{% if new_action == 'hired' %}Принят {% elif new_action == 'dismissed' %}Уволен {% elif new_action == 'on_leave' %}В отпуске {% elif new_action == 'returned_from_leave' %}Вернулся из отпуска {% elif new_action == 'on_maternity' %}В декрете {% elif new_action == 'returned_from_maternity' %}Вернулся из декрета {% elif new_action == 'transferred' %}Переведен {% elif new_action == 'rehired' %}Восстановлен {% else %}{% firstof a.action_display a.action %}{% endif %} {% firstof h.history_date_display h.history_date %}{% if h.history_user %} • {{ h.history_user }}{% endif %}
{% if h.changes %}
{% for field, diff in h.changes.items %} {% if field != 'action' %}
{% if field == 'date' %}Дата события {% elif field == 'comment' %}Комментарий {% elif field == 'extra' %}Дополнительно {% elif field == 'employee_id' %}Сотрудник {% else %}{{ field }}{% endif %} : {% if field == 'extra' and diff.new %} {% if diff.new.items %} {% for ek, ev in diff.new.items %} {% if not forloop.first %}, {% endif %}{{ ek }}: {{ ev }} {% endfor %} {% else %} {{ diff.new }} {% endif %} {% else %} {{ diff.new }} {% endif %}
{% endif %} {% endfor %}
{% endif %}
{% endwith %} {% endfor %}
{% endif %}
{% empty %}
Событий нет.
{% endfor %}
{% endif %} {% endwith %} {% endwith %} {% endif %} {# ====== НАВЫКИ ====== #}
Навыки
{% with skills=emp.skills %} {% if skills %} {% for s in skills %} {% firstof s.name s as sk_name %} {% if sk_name %} {{ sk_name }} {% if perms.employees.manage_employee_skills or request.user.is_staff or request.user.is_superuser or is_me %} {% endif %} {% endif %} {% endfor %} {% else %} {% endif %} {% endwith %} {% if perms.employees.manage_employee_skills or request.user.is_staff or request.user.is_superuser or is_me %} {% endif %}
{% if perms.employees.manage_employee_skills or request.user.is_staff or request.user.is_superuser or is_me %}
{% csrf_token %}
{% for sk in all_skills %} {% if sk.name %}{% endif %} {% endfor %}
{% endif %}
{% if can_edit %}
Редактирование профиля
{% if is_me %} {% url 'employees:employee_edit_me' as edit_endpoint %} {% else %} {% url 'employees:employee_edit' emp.id as edit_endpoint %} {% endif %} {% include "employees/_employee_edit.html" with emp=emp endpoint=edit_endpoint %}
{% endif %}
Активность
{% if posts %} {% include "feed/_feed_cards.html" with items=posts %} {% else %}
Публикаций пока нет.
{% endif %}
{% endblock %} {% block extra_js %} {% endblock %}