This repository has been archived by the owner on Apr 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathReport.jsx
101 lines (97 loc) · 2.47 KB
/
Report.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* eslint one-var: 0, class-methods-use-this: 0 */
import React from 'react';
import BaseTemplate from './Base';
/**
* Report template
*/
export default class Report extends BaseTemplate {
getDefaultData() {
return {
company: {
name: '[company/name]',
logo_url: '[company/logo_url]',
},
project: '[project]',
reporter: '[reporter]',
date: '[date]',
location: '[location]',
reference: '[reference]',
version: '[version]',
};
}
render() {
const data = this.getData();
const
reportStyle = {},
companyStyle = {
margin: '2cm 0 3cm',
textAlign: 'center',
},
metaStyle = {
margin: '1cm 0 3cm',
fontFamily: 'consolas, monospace',
textAlign: 'left',
},
contentStyle = {
fontFamily: '"Helvetica Neue", Helvetica, Roboto, Arial, sans-serif !important',
},
signatureStyle = {
marginTop: '2cm',
paddingTop: '0.3cm',
borderTop: '1px solid #ccc',
fontSize: '10pt',
textAlign: 'right',
};
return (
<article style={reportStyle}>
<header>
{'[company/logo_url]' !== data.company.logo_url ?
<div style={companyStyle}>
<img
src={data.company.logo_url}
alt={`${data.company.name} logo`}
/>
</div> : null
}
<h1>Activity report</h1>
<table style={metaStyle}>
<tbody>
<tr>
<th>Project</th>
<td>{data.project}</td>
</tr>
<tr>
<th>Reporter</th>
<td>{data.reporter}</td>
</tr>
<tr>
<th>Date</th>
<td>{data.date}</td>
</tr>
<tr>
<th>Location</th>
<td>{data.location}</td>
</tr>
<tr>
<th>Reference</th>
<td>{data.reference}</td>
</tr>
<tr>
<th>Version</th>
<td>{data.version}</td>
</tr>
</tbody>
</table>
</header>
<section style={contentStyle}>
{this.props.content}
</section>
<footer style={signatureStyle}>
<div>
Reported on {data.date} by {data.reporter}
</div>
</footer>
</article>
);
}
}