{% set workflow_action_groups = action_groups_by_euid.get(workflow.euid, {}) if action_groups_by_euid is defined else {} %}
{% if workflow_action_groups %}
Workflow Actions
{% for group_key, group_value in workflow_action_groups.items() %}
{{ group_value.group_name }}
{% for action_key, action_value in group_value.actions.items() %}
{% endfor %}
{% endfor %}
{% endif %}
{% macro render_step(step, accordion_states, step_descendant_summaries, depth=0) %}
{% set is_workflow_step = step.polymorphic_discriminator in ['workflow_step_instance', 'workflow_instance'] %}
{% set step_type = step.type %}
{% set step_id = "step-" ~ step.euid %}
{% set is_open = accordion_states.get(step.euid, 'closed') == 'open' %}
{% set descendant_summary = step_descendant_summaries.get(step.euid, {"total_descendants": 0, "counts_by_category": {}, "counts_by_type": {}}) if step_descendant_summaries is defined else {"total_descendants": 0, "counts_by_category": {}, "counts_by_type": {}} %}
{% set type_breakdown = [] %}
{% for child_type, child_count in descendant_summary.counts_by_type|dictsort(false, 'value')|reverse %}
{% set _ = type_breakdown.append(child_type ~ ': ' ~ child_count) %}
{% endfor %}
{% set type_breakdown_title = type_breakdown|join(' | ') %}
{# Separate workflow step children from container and content children #}
{# Query both container_instance AND content_instance lineages per Rule 6 (polymorphic identity naming) #}
{% set workflow_children = [] %}
{% set container_children = [] %}
{% set content_children = [] %}
{% if step.parent_of_lineages %}
{% for child_lineage in step.get_sorted_parent_of_lineages(['container_instance', 'content_instance']) %}
{% set child = child_lineage.child_instance %}
{% if child.category == 'workflow_step' %}
{% set _ = workflow_children.append(child) %}
{% elif child.category == 'content' %}
{% set _ = content_children.append(child) %}
{% else %}
{# container category #}
{% set _ = container_children.append(child) %}
{# Also collect contents FROM this container #}
{% if child.parent_of_lineages %}
{% for content_lineage in child.parent_of_lineages %}
{% set content = content_lineage.child_instance %}
{% if content.category == 'content' %}
{% set _ = content_children.append(content) %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{{ step.euid }}🕸️
{% if step_type == 'plate' or step_type == 'rack' %}
{% endif %}
{% set step_action_groups = action_groups_by_euid.get(step.euid, {}) if action_groups_by_euid is defined else {} %}
{% if step_action_groups %}
{% for group_key, group_value in step_action_groups.items() %}
{{ group_value.group_name }}
{% for action_key, action_value in group_value.actions.items() %}
{% endfor %}
{% endfor %}
{% endif %}
{% if step_type == 'package' %}
Carrier Tracking
{% set fedex_data = step.json_addl.get('properties', {}).get('fedex_tracking_data', []) %}
{% if fedex_data|length > 0 %}
{# Show contents nested under this container #}
{% if container.parent_of_lineages %}
{% for content_lineage in container.parent_of_lineages %}
{% set content = content_lineage.child_instance %}
{% if content.category == 'content' %}