bp/app/Views/components/kanban/default_card.twig

77 lines
3.0 KiB
Twig

{#
default_card.twig - Карточка по умолчанию для Канбан-компонента
Параметры:
- item: Объект элемента
- column: Объект колонки (для доступа к color и т.д.)
Ожидаемые поля в item:
- id: Идентификатор
- title: Заголовок
- url: Ссылка на просмотр (опционально)
- amount: Сумма для отображения (опционально)
- date: Дата для отображения (опционально)
- assignee: Ответственный (опционально)
- status: Статус для цветовой маркировки (опционально)
#}
<div class="card mb-2 kanban-card"
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">
{% if item.url %}
<a href="{{ item.url }}" class="text-decoration-none">
<strong class="text-dark">{{ item.title }}</strong>
</a>
{% else %}
<strong class="text-dark">{{ item.title }}</strong>
{% endif %}
{% if item.amount is defined and item.amount %}
<span class="badge bg-light text-dark">
{{ item.amount|number_format(0, ',', ' ') }}
</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.assignee is defined and item.assignee %}
<small class="text-muted">
<i class="fa-solid fa-user-check me-1"></i>
{{ item.assignee }}
</small>
{% else %}
<small></small>
{% endif %}
{% if item.date is defined and item.date %}
<small class="{{ item.isOverdue is defined and item.isOverdue ? 'text-danger' : 'text-muted' }}">
<i class="fa-regular fa-calendar me-1"></i>
{{ item.date|date('d.m') }}
</small>
{% endif %}
</div>
{# Теги/метки #}
{% if item.tags is defined and item.tags|length > 0 %}
<div class="mt-2 d-flex flex-wrap gap-1">
{% for tag in item.tags %}
<span class="badge" style="background-color: {{ tag.color }}20; color: {{ tag.color }}; font-size: 0.65rem;">
{{ tag.name }}
</span>
{% endfor %}
</div>
{% endif %}
</div>
</div>