Commit 1c57184f by Luciano Barletta

Terminadas modificaciones

1 parent e5892f4d
...@@ -82,7 +82,10 @@ class PDF3 { ...@@ -82,7 +82,10 @@ class PDF3 {
table(pointer, title, data) { table(pointer, title, data) {
const table = this.A4.addRelativeChild( new Div(pointer.addxy(5,1), new Vector(90, 2 * (data.length + 1))) ); const lines = this.makelines(data, 55);
title = this.partition(title, 20)
const table = this.A4.addRelativeChild( new Div(pointer.addxy(5,1), new Vector(90, 2 * (lines.length + 1))) );
const left = table.addRelativeChild( new Div(new Vector(0,0), new Vector(30, 100)) ); const left = table.addRelativeChild( new Div(new Vector(0,0), new Vector(30, 100)) );
const right = table.addRelativeChild( new Div(new Vector(30,0), new Vector(70, 100)) ); const right = table.addRelativeChild( new Div(new Vector(30,0), new Vector(70, 100)) );
...@@ -93,24 +96,46 @@ class PDF3 { ...@@ -93,24 +96,46 @@ class PDF3 {
left.addRelativeChild( left.addRelativeChild(
new Text( new Text(
title, title,
new Vector(Pos.middle, Pos.middle + 10), new Vector(Pos.middle, Pos.middle - (title.length - 1) * 1.1),
this.subtitle, this.subtitle,
"center" "center"
) )
) )
let subpointer = right.position.addxy(5, 0.025 * this.A4.size.y); let subpointer = right.position.addxy(186, 0.025 * this.A4.size.y);
data.forEach( entry => {
lines.forEach( text => {
right.addAbsoluteChild( right.addAbsoluteChild(
new Text( new Text(text, subpointer, this.body, "center")
`${entry['description']} - ${entry['severity']}`,
subpointer,
this.body,
)
); );
subpointer = subpointer.addxy(0, 0.02 * this.A4.size.y); subpointer = subpointer.addxy(0, 0.02 * this.A4.size.y);
}); });
return pointer.addxy(0, 2 * (data.length + 1) + 1); return pointer.addxy(0, 2 * (lines.length + 1) + 1);
}
makelines(data, linesize) {
/** merge all segment lists to make the actual lines that will be used **/
return data.reduce( (lines, entry) =>
lines.concat(
this.partition(`${entry['description']} - ${entry['severity']}`, linesize)
),
[]
);
}
/** slice in segments of 70 characters **/
partition(string, linesize) {
const result = [];
let s = 0;
while (string.slice(s, s + linesize) !== '') {
result.push(string.slice(s, s + linesize));
s += linesize;
}
return result;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
tr { tr {
border-right: 2px solid black; border-right: 2px solid black;
} }
p {
word-break: break-all;
}
</style> </style>
<div> <div>
...@@ -52,11 +56,11 @@ ...@@ -52,11 +56,11 @@
{% for a in anomalies['anomalies'] %} {% for a in anomalies['anomalies'] %}
<table> <table>
<tr> <tr>
<th rowspan="{{ (anomalies['anomalies'][a] | length) + 1 }}">{{ a }}</th> <th rowspan="{{ (anomalies['anomalies'][a] | length) + 1 }}"><p>{{ a }}</p></th>
</tr> </tr>
{% for e in anomalies['anomalies'][a] %} {% for e in anomalies['anomalies'][a] %}
<tr> <tr>
<td>{{ e['description'] }} - {{ e['severity'] }}</td> <td><p>{{ e['description'] }} - {{ e['severity'] }}</p></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
......
...@@ -150,13 +150,13 @@ ...@@ -150,13 +150,13 @@
Por defecto: <input name="defecto" type="text" value="---"> Por defecto: <input name="defecto" type="text" value="---">
<div class="PDFButtonContainer"> <div class="PDFButtonContainer">
<button class="PDFButton" onclick="collectToSearch('data')">
Datos
</button>
<button class="PDFButton" onclick="collectToSearch('anomalies')"> <button class="PDFButton" onclick="collectToSearch('anomalies')">
Anomalías Anomalías
</button> </button>
<button class="PDFButton" onclick="collectToSearch('data')">
Ticket Fosa
</button>
</div> </div>
<button class="PDFButton loginB" onclick= "location.href='/login'"> <button class="PDFButton loginB" onclick= "location.href='/login'">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!