{% extends "page.html" %} {% macro bom_item_row(item, depth=0, visited=[]) %} {% set child_bom = item.child_bom %} {% set child_id = 'bom-detail-children-' ~ child_bom.id ~ '-' ~ depth %} {% set can_expand = child_bom.children and child_bom.id not in visited %}
{% if can_expand %} {% else %} {% endif %}
{% if child_bom.number %}{{ child_bom.number }}{% endif %} {{ child_bom.name }} {% if child_bom.is_part_wrapper %}{{ _('Part') }}{% else %}{{ _('BOM') }}{% endif %}
{{ item.quantity.normalize() if item.quantity else 1 }}
{{ format_bom_cost(child_bom) }}
{% if child_bom.is_part_wrapper and child_bom.component %} {% elif not child_bom.is_part_wrapper %} {% endif %}
{% if can_expand %}
{% set next_visited = visited + [child_bom.id] %} {% for child_item in child_bom.children|sort(attribute='position') %} {{ bom_item_row(child_item, depth + 1, next_visited) }} {% endfor %}
{% endif %}
{% endmacro %} {% block style %} {% endblock style %} {% block main_view_content %}

{{ _('Bill of Materials') }}

{{ bom.name }}

{{ bom.number }}
{{ _('BOM number') }} {{ bom.number }}
{{ _('Name') }} {{ bom.name }}
{{ _('Description') }} {{ bom.description }}
{{ _('Estimated cost') }} {{ format_bom_cost(bom) }}

{{ _('BOM items') }}

{{ _('Name') }} {{ _('Quantity') }} {{ _('Total cost') }} {{ _('Actions') }}
{% for item in bom.children|sort(attribute='position') %} {{ bom_item_row(item)|safe }} {% else %}
{{ _('No BOM items have been added yet.') }}
{% endfor %}

{{ _('Parts') }}

{{ ngettext('%(num)s part found.', '%(num)s parts found.', part_rows|length) }}

{% for part_row in part_rows %} {% set component = part_row.component %} {% else %} {% endfor %}
{{ _('Part number') }} {{ _('Name') }} {{ _('Quantity') }}
{{ component.number }} {{ component.name }} {{ part_row.quantity }}
{{ _('No parts found in this BOM.') }}
{% endblock main_view_content %} {% block script %} {% endblock script %}