{% extends "layouts/mobile_base.twig" %} {% set active_nav = 'tasks' %} {% block title %}{{ translations.tasks ?? 'Tasks' }}{% endblock %} {% block page_title %}{{ translations.tasks ?? 'Tasks' }}{% endblock %} {% block page_subtitle %} {{ translations.tasks_subtitle ?? 'Daily checklist & responsibilities' }} {% endblock %} {% block head %} {% endblock %} {% block content %} {% set tasks = tasks|default([]) %} {# FILTERS #}
{{ translations.filters ?? 'Filters' }}
{# STATUS FILTER (default: undone) #}
{{ translations.status ?? 'Status' }}
{{ translations.only_undone ?? 'Only undone' }} {{ translations.only_done ?? 'Only done' }} {{ translations.all ?? 'All' }}
{# FEATURE FILTERS (your existing ones) #}
{{ translations.details_filters ?? 'Details' }}
{{ translations.all ?? 'All' }} {{ translations.mandatory ?? 'Mandatory' }} {{ translations.requires_photo ?? 'Photo' }} {{ translations.high_priority ?? 'Priority 5' }} {{ translations.daily ?? 'Daily' }}
{{ translations.tasks_filter_hint ?? 'Tap filters to narrow down your list.' }}
{# EMPTY #} {% if tasks is empty %}
{{ translations.no_tasks ?? 'No tasks' }}
{{ translations.no_tasks_subtitle ?? 'You have no assigned tasks right now.' }}
{% else %} {# BUILD: section -> category -> subcategory -> tasks #} {% set sections = {} %} {% for t in tasks %} {% set sec = t.getSectionName() ?: (translations.other ?? 'Other') %} {% set cat = t.getCategoryName() ?: (translations.other ?? 'Other') %} {% set sub = t.getSubcategoryName() ?: (translations.other ?? 'Other') %} {% set secNode = sections[sec]|default({}) %} {% set catNode = secNode[cat]|default({}) %} {% set subArr = catNode[sub]|default([]) %} {% set catNode = catNode|merge({ (sub): subArr|merge([t]) }) %} {% set secNode = secNode|merge({ (cat): catNode }) %} {% set sections = sections|merge({ (sec): secNode }) %} {% endfor %}
{# SECTION level #} {% for secName, categories in sections %} {# count tasks in section #} {% set secCount = 0 %} {% for catName, subs in categories %} {% for subName, arr in subs %} {% set secCount = secCount + (arr|length) %} {% endfor %} {% endfor %}
{{ secName }}
{{ secCount }}
{# CATEGORY level #} {% for catName, subs in categories %} {# count tasks in category #} {% set catCount = 0 %} {% for subName, arr in subs %} {% set catCount = catCount + (arr|length) %} {% endfor %}
{{ catName }}
{{ catCount }}
{# SUBCATEGORY #} {% for subName, items in subs %}
{{ subName }} {{ items|length }}
{% for t in items %} {% set freq = t.getFrequency()|default('') %} {% set prio = t.getPriority()|default(0) %} {% set mand = t.getIsMandatory() ? 1 : 0 %} {% set photo = t.getRequiresPhoto() ? 1 : 0 %} {% set done = t.isDone() ? 1 : 0 %}

{{ t.getName() }}

{% if prio %} P{{ prio }} {% endif %}
{% if t.getDescription() %}
{{ t.getDescription() }}
{% endif %}
{% if t.getExecutionTime() %} {{ t.getExecutionTime()|slice(0,5) }} {% endif %} {% if freq %} {{ freq }} {% endif %} {% if mand %} {{ translations.mandatory ?? 'Mandatory' }} {% endif %} {% if photo %} {{ translations.photo_required ?? 'Photo required' }} {% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endif %} {% endblock %} {% block scripts %} {% endblock %}