{% extends "modern/base.html" %} {% block title %}Workflow Details - BLOOM LIMS{% endblock %} {% block extra_css %} {% endblock %} {% block content %} {% 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 %} {% if workflow.child_of_lineages %} {% set linked_requisitions = [] %} {% for lineage in workflow.child_of_lineages %} {% if lineage.parent_instance and lineage.parent_instance.type == 'test_requisition' and not lineage.parent_instance.is_deleted %} {% set _ = linked_requisitions.append(lineage.parent_instance) %} {% endif %} {% endfor %} {% if linked_requisitions|length > 0 %}

Linked Test Requisitions ({{ linked_requisitions|length }})

{% for trx in linked_requisitions %}
{{ trx.euid }} {{ trx.json_addl.get('properties', {}).get('name', '') }} {{ trx.bstatus }} 🕸️
{% set trx_action_groups = action_groups_by_euid.get(trx.euid, {}) if action_groups_by_euid is defined else {} %} {% if trx_action_groups %}
{% for group_key, group_value in trx_action_groups.items() %}
{{ group_value.group_name }}: {% for action_key, action_value in group_value.actions.items() %} {% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %} {% 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 %}
Status: {{ fedex_data[0].get('status', 'N/A') }}
Transit Time: {{ ((fedex_data[0].get('Transit_Time_sec', 0) | float) / 3600) | round(1) }} hours
Origin: {{ fedex_data[0].get('origin_state', 'N/A') }}
Ship Date: {{ fedex_data[0].get('ship_date', 'N/A') }}
Delivery: {{ fedex_data[0].get('delivery_date', 'N/A') }}
{% endif %}
{% endif %}
Edit Properties
{% for key, value in step.json_addl.get('properties', {}).items() %}
{% if value is string %} {% elif value is iterable and value is not mapping %}
{% for item in value %} {% endfor %}
{% else %} {% endif %}
{% endfor %}
{% if container_children|length > 0 %}
Linked Containers ({{ container_children|length }}) {% if content_children|length > 0 %} 🧪 {{ content_children|length }} {% endif %}
{% endif %} {% if workflow_children|length > 0 %}
{% for child_step in workflow_children %} {{ render_step(child_step, accordion_states, step_descendant_summaries, depth + 1) }} {% endfor %}
{% endif %}
{% endmacro %}

Workflow Steps

{% for step in workflow.get_sorted_parent_of_lineages(['workflow_instance']) %} {{ render_step(step.child_instance, accordion_states, step_descendant_summaries) }} {% else %}

No workflow steps found.

{% endfor %}
Back to Workflow Summary
{% endblock %} {% block extra_js %} {% endblock %}