templates: update BOM height responsiveness

This commit is contained in:
Laurier Loiselle 2023-03-29 14:21:52 -04:00
parent f0a6631af5
commit 6dd9a303af
No known key found for this signature in database
GPG Key ID: 345920CC72089A3F
4 changed files with 11 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<style> <style>
.A4 #bom { /* BOM on top of title block */ .A4 #bom { /* BOM on top of title block */
position: absolute; position: absolute;
bottom: 38.25mm; bottom: calc({{ titleblock_rows + 1 }} * 4.25mm);
right: 0; right: 0;
} }
@ -52,7 +52,7 @@
<!-- BOM TEMPLATE --!> <!-- BOM TEMPLATE --!>
<div id="bom"> <div id="bom">
<table id="bom"> <table>
{% if not bom_reversed %} {% if not bom_reversed %}
{{ bom_header_gen() }} {{ bom_header_gen() }}
{% endif %} {% endif %}

View File

@ -58,7 +58,11 @@
top: 0; top: 0;
left: 0; left: 0;
max-width: 100%; max-width: 100%;
height: calc(100% - 13 * 4.25mm); {% if sheetsize == 'A4' %}
height: calc(100% - {{ [bom_length, 13]|sum }} * 4.25mm);
{% else %}
height: calc(100% - {{ [bom_length, 13]|max }} * 4.25mm);
{% endif %}
/* TODO: auto-adapt to height of title block + BOM table; /* TODO: auto-adapt to height of title block + BOM table;
BOM table might be above (A4) or to the left (A3 and larger) of the title block */ BOM table might be above (A4) or to the left (A3 and larger) of the title block */
text-align: center; text-align: center;

View File

@ -7,7 +7,7 @@
#titleblock { #titleblock {
width: 180mm; width: 180mm;
height: 38.25mm; height: calc({{ titleblock_rows }} * 4.25mm));
} }
#titleblock table, th, td { #titleblock table, th, td {

View File

@ -95,6 +95,7 @@ def generate_html_output(
if bom_reversed: if bom_reversed:
bom_content.reverse() bom_content.reverse()
if metadata: if metadata:
sheet_current = metadata["sheet_current"] sheet_current = metadata["sheet_current"]
sheet_total = metadata["sheet_total"] sheet_total = metadata["sheet_total"]
@ -113,6 +114,8 @@ def generate_html_output(
"bom_header": bom_header, "bom_header": bom_header,
"bom_content": bom_content, "bom_content": bom_content,
"bom_columns": bom_columns, "bom_columns": bom_columns,
"bom_length": len(bom_content),
"titleblock_rows": 9,
} }
# prepare metadata replacements # prepare metadata replacements