{# یک ردیف تسک در بخش «کارها». با `with context` ایمپورت شود (به jalali و allowed_page_keys نیاز دارد). #} {% macro task_row(item, today, show_folder=False) %} {% set back_url = request.full_path if request.query_string else request.path %} {% set overdue = item.due_date and not item.is_done and item.due_date < today %} {% set subs = [] %}{% for sub in item.subtasks %}{% set _ = subs.append({"id": sub.id, "title": sub.title, "done": sub.is_done}) %}{% endfor %} {% set done_subs = item.subtasks | selectattr("is_done") | list | length %}
{{ item.title }}
{% if item.due_date %} {% if overdue %}⚠ {% endif %}{{ jalali.to_jalali_str(item.due_date) }}{% if item.due_time %} · {{ jalali.to_fa_digits('%02d:%02d'|format(item.due_time.hour, item.due_time.minute)) }}{% endif %} {% endif %} {% if item.repeat_rule %}🔁 {{ repeat_labels.get(item.repeat_rule, item.repeat_rule) }}{% endif %} {% if show_folder and item.folder %} {{ item.folder.name }} {% endif %} {% if item.customer %} {% if item.customer.is_deleted %} مشتری حذف‌شده {% elif item.customer.mobile_phone or item.customer.landline_phone %} 📱 {{ item.customer.mobile_phone or item.customer.landline_phone }} {% endif %} {% endif %} {% if item.assignee %}👤 {{ item.assignee.full_name }}{% endif %} {% if item.notes %}📝 یادداشت{% endif %} {% if item.subtasks %}☑ {{ jalali.to_fa_digits(done_subs) }} از {{ jalali.to_fa_digits(item.subtasks|length) }}{% endif %} {% if item.is_done and item.completer %} ✓ {{ item.completer.full_name }} — {{ jalali.to_jalali_str(item.done_at, with_time=true) }} {% endif %}
{% if item.subtasks %}
{% for sub in item.subtasks %}
{% endfor %}
{% endif %}
{% if item.customer_id and not (item.customer and item.customer.is_deleted) and "calls" in allowed_page_keys() %} 📞 {% endif %} {% if item.customer_id and not (item.customer and item.customer.is_deleted) and "customer_profile" in allowed_page_keys() %} 👤 {% endif %}
{% endmacro %}