bp/app/Modules/Tasks/Views/components/task_card.twig

59 lines
2.6 KiB
Twig

{#
task_card.twig - Карточка задачи для Канбан-компонента
Параметры:
- item: Объект задачи
- column: Объект колонки (для доступа к color и т.д.)
#}
<div class="card mb-2 kanban-card {{ item.completed_at ? 'opacity-75' : '' }}"
draggable="true"
data-item-id="{{ item.id }}"
style="cursor: grab;">
<div class="card-body py-2 px-3">
{# Заголовок #}
<div class="d-flex justify-content-between align-items-start mb-2">
<a href="{{ base_url('/tasks/' ~ item.id) }}" class="text-decoration-none flex-grow-1">
<strong class="text-dark">{{ item.title }}</strong>
</a>
{# Индикатор приоритета #}
{% if item.priority == 'urgent' %}
<span class="badge bg-danger ms-2" style="font-size: 0.6rem;">Срочно</span>
{% elseif item.priority == 'high' %}
<span class="badge bg-warning text-dark ms-2" style="font-size: 0.6rem;">Высокий</span>
{% endif %}
</div>
{# Описание #}
{% if item.description is defined and item.description %}
<small class="text-muted d-block mb-2">
{{ item.description|length > 50 ? item.description|slice(0, 50) ~ '...' : item.description }}
</small>
{% endif %}
{# Нижняя панель #}
<div class="d-flex justify-content-between align-items-center">
{# Дата и статус просроченности #}
{% if item.due_date is defined and item.due_date %}
{% set isOverdue = item.due_date < date('now') and not item.completed_at %}
<small class="{{ isOverdue ? 'text-danger fw-bold' : (item.completed_at ? 'text-success' : 'text-muted') }}">
<i class="fa-regular fa-calendar me-1"></i>
{{ item.due_date|date('d.m') }}
{% if item.completed_at %}
<i class="fa-solid fa-check ms-1" style="font-size: 0.7rem;"></i>
{% elseif isOverdue %}
<i class="fa-solid fa-circle-exclamation ms-1" style="font-size: 0.6rem;" title="Просрочено"></i>
{% endif %}
</small>
{% else %}
<small></small>
{% endif %}
{# Кнопка просмотра #}
<a href="{{ base_url('/tasks/' ~ item.id) }}" class="btn btn-sm btn-outline-primary" title="Просмотр">
<i class="fa-solid fa-eye"></i>
</a>
</div>
</div>
</div>