templates: add bom

This commit is contained in:
Laurier Loiselle 2023-01-25 13:25:16 -05:00
parent 3b2174a047
commit 04f18ae1f2
No known key found for this signature in database
GPG Key ID: 345920CC72089A3F

73
src/wireviz/templates/bom.html generated Normal file
View File

@ -0,0 +1,73 @@
<style>
.A4 #bom { /* BOM on top of title block */
position: absolute;
bottom: 38.25mm;
right: 0;
}
.A3 #bom, .A2 #bom { /* BOM to the left of title block */
position: absolute;
bottom: 0mm;
left: 0mm;
}
#bom table {
width:180mm;
}
#bom tr {
height: 4.25mm;
}
#bom tr:nth-child(odd) {
background-color: #EEEEEE
}
#bom table, th, td {
border: 1px solid black;
border-collapse: collapse;
text-align: left;
}
#bom .bom_col_id {
text-align: center;
font-weight: bold;
}
#bom .bom_col_qty {
text-align: right;
}
</style>
<!-- BOM HEADER GENERATION MACRO --!>
{% macro bom_header_gen() -%}
<tr>
{% for item in bom_header %}
<td class="{{bom_columns[loop.index0]}}"><b> {{ item }} </b></td>
{% endfor %}
</tr>
{%- endmacro %}
<!-- BOM TEMPLATE --!>
<div id="bom">
<table >
{% if not bom_reversed %}
{{ bom_header_gen() }}
{% endif %}
{% for row in bom_content %}
<tr>
{% for item in row %}
<td class="{{bom_columns[loop.index0]}}"> {{ item }} </td>
{% endfor %}
</tr>
{% endfor %}
{% if bom_reversed %}
{{ bom_header_gen() }}
{% endif %}
</table >
</div>