{% extends "page.html" %}
{% block page_content %}
<div class="card">
    <div class="card-header"><h2>Опросники</h2>
        <a class="btn btn-primary btn-sm" href="/service/questionnaire/step/1">+ Новый опросник</a>
    </div>
    <div class="table-wrap"><table><thead><tr><th>ID</th><th>Клиент</th><th>Автор</th><th>Статус</th><th>Шаг</th><th>Дата</th></tr></thead>
        <tbody>{% for s, author in sessions %}<tr>
            <td>#{{ s.id }}</td><td>{{ s.client_name }}</td><td>{{ author }}</td>
            <td><span class="badge badge-{{ s.status }}">{{ {'draft':'Черновик','completed':'Завершён','cancelled':'Отменён'}[s.status] }}</span></td>
            <td>{{ s.current_step }}/5</td>
            <td><small>{{ s.created_at.strftime('%d.%m.%Y') if s.created_at else '' }}</small></td>
        </tr>{% endfor %}</tbody></table>
    </div>
</div>
{% endblock %}
