integrated front and back
This commit is contained in:
@@ -8,9 +8,25 @@ export function renderWorkoutCard(w) {
|
||||
const isExpanded = state.expandedWorkoutId === w.id;
|
||||
const isReadOnly = w.synced && w.endTime;
|
||||
|
||||
// Определяем цвет тренировки
|
||||
let clientColor = null;
|
||||
let clientName = null;
|
||||
if (w.client_id) {
|
||||
const client = state.clients.find(c => c.id == w.client_id);
|
||||
if (client) {
|
||||
clientColor = client.color;
|
||||
clientName = client.full_name;
|
||||
}
|
||||
}
|
||||
|
||||
const div = document.createElement('div');
|
||||
div.className = 'workout-accordion';
|
||||
|
||||
// Добавляем цветной border-left, если есть клиент
|
||||
if (clientColor) {
|
||||
div.style.borderLeft = `4px solid ${clientColor}`;
|
||||
}
|
||||
|
||||
const headerClass = `workout-header ${isActive ? 'active' : 'completed'}`;
|
||||
const dateStr = formatDate(w.startTime);
|
||||
const typeStr = w.type || 'тип не выбран';
|
||||
@@ -28,11 +44,17 @@ export function renderWorkoutCard(w) {
|
||||
</span>`
|
||||
: '';
|
||||
|
||||
// Метка клиента (если есть)
|
||||
const clientLabel = clientName
|
||||
? `<div class="workout-meta" style="color:${clientColor}; font-weight:600;">👤 ${clientName}</div>`
|
||||
: '';
|
||||
|
||||
div.innerHTML = `
|
||||
<div class="${headerClass}" onclick="WL.toggleWorkout('${w.id}')">
|
||||
<div>
|
||||
<div style="font-weight:600;">${isActive ? '🔥 Тренировка' : '✅ Завершена'}</div>
|
||||
<div class="workout-meta">${dateStr} ${editDateBtn} • ${typeStr}</div>
|
||||
${clientLabel}
|
||||
<div class="workout-meta">Упр: ${exCount} • Кардио: ${cardioCount}</div>
|
||||
</div>
|
||||
<div>${statusBadge} <span class="chevron ${isExpanded ? 'open' : ''}">›</span></div>
|
||||
|
||||
Reference in New Issue
Block a user