diff options
-rw-r--r-- | src/ee/templates/bom.rst.j2 | 57 |
1 files changed, 13 insertions, 44 deletions
diff --git a/src/ee/templates/bom.rst.j2 b/src/ee/templates/bom.rst.j2 index 454d3f1..b9c8b6a 100644 --- a/src/ee/templates/bom.rst.j2 +++ b/src/ee/templates/bom.rst.j2 @@ -2,68 +2,37 @@ BOM === -{%- if unresolved_parts %} +{#- +{% if unresolved_parts -%} Unresolved Parts ---------------- -{{- unresolved_parts|length }} unresolved parts: {% for bp in unresolved_parts %} -* `{{ bp.ref }} <ref-{{ bp.ref }}_>`_ +* `{{ bp.ref }} <{{ bp.ref }}_>`_ {%- endfor %} {%- endif %} +#} + +{% if unresolved_parts -%} +There are {{ unresolved_parts|length }} unresolved parts. +{%- endif %} +-{{ "-"*30 }}-+-{{ "-"*60 }}-+-{{ "-"*60 }}-+ | {{ "%-30s" | format("Reference") }} | {{ "%-60s" | format("MPN") }} | {{ "%-60s" | format("MPN") }} | +={{ "="*30 }}=+={{ "="*60 }}=+={{ "="*60 }}=+ {%- for bp in bom_parts %} {%- set ref="_`{}`".format(bp.ref, bp.ref) %} +{%- if bp.selected_part %} {%- set mpn=bp.selected_part.get_only_mpn().valueProp %} {%- set spn=bp.selected_part.get_only_spn().valueProp %} {%- set spn="`{} <part-{}_>`_".format(spn, spn) %} +{%- else %} +{%- set mpn="Unresolved" %} +{%- set spn="" %} +{%- endif %} | {{ "%-30s" | format(ref) }} | {{ "%-60s" | format(mpn) }} | {{ "%-60s" | format(spn) }} | +-{{ "-"*30 }}-+-{{ "-"*60 }}-+-{{ "-"*60 }}-+ {%- endfor %} -{# -Parts for BOM -=============== -{% for bp in bom_parts %} -.. _ref-{{ bp.ref }}: - -{{ bp.ref | subsection }} -{% if not bp.selected_part %} -Could not find part. - -{% if bp.part.get_mpns()|length == 1 -%} -MPN: {{ bp.part.get_mpns()[0].valueProp }} -{% elif bp.part.get_mpns()|length > 1 -%} -{%- for mpn in bp.part.get_mpns() %} -MPNs: -* {{ mpn.valuePrbp }} -{%- endfor %} -{%- endif -%} -#} -{# #}{# - -{% if bp.part.get_spns()|length == 1 -%} -SPN: {{ bp.part.get_spns()[0].valueProp }} -{% elif bp.part.get_spns()|length > 1 -%} -{%- for spn in bp.part.get_spns() %} -SPNs: -* {{ spn.valueProp }} -{%- endfor %} -{%- endif -%} - -{% elif bp.selected_part %} -{%- set part=bp.selected_part %} -{%- set pn=part|first_pn %} -{%- set spn=part|first_spn %} -Selected supplier: {{ part.supplier }}{{ (", pn: " + pn.valueProp) if pn else "" }}{{ (", spn: " + spn.valueProp) if spn else "" }}. -Part: `{{pn.valueProp}} <part-{{pn.valueProp}}_>`_ -{% else %} -MANY -{% endif %} -{%- endfor %} -#} Part details ============ |