Files
ACORE/templates/partials/employee-profile-aside.html
T
lokses bf5310e489 Hide peer logins on profiles and restrict view_all to published reports.
Login stays visible only to self/manager/HR; draft report docs stay department-head only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 15:20:49 +03:00

91 lines
6.8 KiB
HTML

{% load common_tags %}
{% load i18n %}
<aside style="background:var(--color-card); border-radius:0.75rem; border:1px solid var(--color-border); box-shadow:0 1px 2px rgb(0 0 0/0.05); padding:1.25rem; position:sticky; top:1rem;">
<div style="text-align:center; margin-bottom:1rem;">
{% if is_own_profile %}
<form hx-post="/employees/{{ employee.pk }}/" hx-target="#main-content" hx-indicator="#loader" hx-encoding="multipart/form-data" enctype="multipart/form-data" style="margin:0; display:inline-block;">
{% csrf_token %}
<input type="hidden" name="profile_tab" value="overview">
<label style="cursor:pointer; position:relative; display:inline-block;" title="{% trans 'Изменить фото' %}">
{% if employee.photo %}
<img src="{{ employee.photo.url }}" alt="" style="width:5.5rem; height:5.5rem; border-radius:50%; object-fit:cover; display:block; margin:0 auto;">
{% else %}
<span style="width:5.5rem; height:5.5rem; border-radius:50%; background:color-mix(in srgb, var(--color-primary) 10%, transparent); color:var(--color-primary); display:flex; align-items:center; justify-content:center; font-size:1.5rem; font-weight:600; margin:0 auto;">{{ employee|initials }}</span>
{% endif %}
<span style="position:absolute; bottom:0; right:0; width:1.5rem; height:1.5rem; border-radius:50%; background:var(--color-primary); color:var(--color-primary-foreground); display:flex; align-items:center; justify-content:center; border:2px solid var(--color-card);">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/></svg>
</span>
<input type="file" name="photo" accept="image/*" style="display:none;" onchange="this.form.requestSubmit()">
</label>
</form>
{% else %}
{% if employee.photo %}
<img src="{{ employee.photo.url }}" alt="" style="width:5.5rem; height:5.5rem; border-radius:50%; object-fit:cover; margin:0 auto; display:block;">
{% else %}
<span style="width:5.5rem; height:5.5rem; border-radius:50%; background:color-mix(in srgb, var(--color-primary) 10%, transparent); color:var(--color-primary); display:flex; align-items:center; justify-content:center; font-size:1.5rem; font-weight:600; margin:0 auto;">{{ employee|initials }}</span>
{% endif %}
{% endif %}
</div>
<h1 style="font-size:1rem; font-weight:600; color:var(--color-foreground); text-align:center; line-height:1.35; margin-bottom:0.5rem;">
{{ employee.last_name }}<br>{{ employee.first_name }}{% if employee.middle_name %} {{ employee.middle_name }}{% endif %}
</h1>
<div style="display:flex; justify-content:center; flex-wrap:wrap; gap:0.375rem; margin-bottom:0.875rem;">
{% if employee.is_active %}<span class="badge badge-success">{% trans "Активный" %}</span>{% else %}<span class="badge badge-danger">{% trans "Не активный" %}</span>{% endif %}
{% if can_view_pii and employee.is_on_probation %}<span class="badge badge-warning">{% trans "Испытательный срок" %}</span>{% endif %}
</div>
<div style="font-size:0.8125rem; color:var(--color-muted-foreground); text-align:center; margin-bottom:1rem; line-height:1.5;">
<div>{% if employee.post %}{{ employee.post.name }}{% else %}{{ employee.groups.first.name|default:"—" }}{% endif %}</div>
{% if employee.department %}
<div style="margin-top:0.25rem;">{{ employee.department.name }}</div>
{% elif employee.user_pharmacy %}
<div style="margin-top:0.25rem;">{% trans "Аптека" %} №{{ employee.user_pharmacy.pharmacy_number }}</div>
{% endif %}
</div>
<div style="border-top:1px solid var(--color-border); padding-top:0.875rem; margin-bottom:1rem; font-size:0.8125rem;">
{% if can_view_pii or is_own_profile %}
<div style="display:flex; justify-content:space-between; gap:0.5rem; margin-bottom:0.375rem;">
<span style="color:var(--color-muted-foreground);">{% trans "Логин" %}</span>
<span style="font-weight:500; text-align:right; word-break:break-all;">{{ employee.username }}</span>
</div>
{% if employee.email %}
<div style="display:flex; justify-content:space-between; gap:0.5rem; margin-bottom:0.375rem;">
<span style="color:var(--color-muted-foreground);">Email</span>
<span style="text-align:right; word-break:break-all;">{{ employee.email }}</span>
</div>
{% endif %}
{% if employee.phone %}
<div style="display:flex; justify-content:space-between; gap:0.5rem; margin-bottom:0.375rem;">
<span style="color:var(--color-muted-foreground);">{% trans "Телефон" %}</span>
<span style="text-align:right;">{{ employee.phone }}</span>
</div>
{% endif %}
{% endif %}
{% if employee.internal_number %}
<div style="display:flex; justify-content:space-between; gap:0.5rem;">
<span style="color:var(--color-muted-foreground);">{% trans "Внутр." %}</span>
<span style="text-align:right;">{{ employee.internal_number }}</span>
</div>
{% endif %}
</div>
<div style="display:flex; flex-direction:column; gap:0.5rem;">
{% if employee.mattermost_user_id and not is_own_profile %}
<a href="/chat/?dm={{ employee.mattermost_user_id }}" hx-get="/chat/?dm={{ employee.mattermost_user_id }}" hx-target="#main-content" hx-push-url="/chat/?dm={{ employee.mattermost_user_id }}" hx-indicator="#loader"
class="btn btn-primary" style="font-size:0.8125rem; text-decoration:none; justify-content:center; width:100%;">
{% trans "Написать в чат" %}
</a>
{% endif %}
{% if not is_own_profile %}
<a href="/tasks/?responsible={{ employee.pk }}" hx-get="/tasks/?responsible={{ employee.pk }}" hx-target="#main-content" hx-push-url="/tasks/?responsible={{ employee.pk }}" hx-indicator="#loader"
class="btn btn-secondary" style="font-size:0.8125rem; text-decoration:none; justify-content:center; width:100%;">{% trans "Назначить задачу" %}</a>
{% endif %}
{% if can_edit %}
<a href="/admin/employees/employee/{{ employee.pk }}/change/" class="btn btn-secondary" style="font-size:0.8125rem; text-decoration:none; justify-content:center; width:100%;">{% trans "Редактировать" %}</a>
{% endif %}
</div>
</aside>