-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.custom-proposal-body.hbs
384 lines (357 loc) · 14.6 KB
/
example.custom-proposal-body.hbs
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- Bootstrap CSS -->
<link
href="http://localhost:4501/static/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9"
crossorigin="anonymous"
/>
<link href="http://localhost:4501/fonts/segoeui" rel="stylesheet">
<style>
body {
font-size: 16px;
line-height: 2;
font-family: SegoeUI;
}
td,
td h6 {
line-height: 1.5;
}
.bold {
font-weight: bold;
}
.w-40 {
width: 40%;
}
.w-60 {
width: 60%;
}
.no-break-inside {
break-inside: avoid;
}
.break-before {
break-before: page;
}
.link-page a::after {
content: target-counter(attr(href), page);
}
.link-page::after {
content: ', ';
}
.link-page:last-of-type::after {
content: none;
}
.index-value::after {
content: ' – ';
}
</style>
<script src="http://localhost:4501/static/js/paged.polyfill.min.js"></script>
</head>
<body>
<div id="bookIndex"></div>
<div id="listindexgenerated"></div>
<div class="root break-before" style="background: 'red'">
<div class="container-fluid m-0 p-0">
<div class="row" data-book-index="Proposal Summary">
<div class="col">
<h2 class="text-center mb-4 bold">{{ proposal.title }}</h2>
<div class="mb-4">
<h4 class="bold">Proposal ID</h4>
{{ proposal.proposalId }} {{userRole.shortCode}}
</div>
{{#if ($eq userRole.shortCode "user_officers")}}
Visible to User officer
{{/if}}
<div class="mb-4">
<h4 class="bold">Brief Summary</h4>
{{ proposal.abstract }}
</div>
<div>
<h4 class="bold" class="mb-2">Proposal Team</h4>
<div class="row">
<div class="col-4">
<p>Proposal Investigator:</p>
</div>
<div class="col-8">
<span
>{{ principalInvestigator.firstname }} {{
principalInvestigator.lastname }}, {{
principalInvestigator.position }}, {{#if principalInvestigator.organisation }}{{
principalInvestigator.organisation }}{{else}}{{ principalInvestigator.institution }}{{/if}}</span
>
</div>
</div>
{{#if coProposers }}
<div class="row">
<div class="col-4">
<p>Co-Investigator:</p>
</div>
<div class="col-8">
{{#each coProposers}}
<span
>{{ this.firstname }} {{ this.lastname }}, {{#if this.organisation }}{{ this.organisation }}{{else}}{{ this.institution }}{{/if}}</span
>
{{/each}}
</div>
</div>
{{/if}}
</div>
</div>
</div>
<div
class="break-before"
data-book-index="Proposal Questionary"
>
{{#each questionarySteps}} {{#unless ($eq this.topic.title "Proposal text") }}
<h4
class="bold my-3"
data-book-index-parent="Proposal Questionary"
data-book-index="{{{this.topic.title}}}"
>
{{ this.topic.title }}
</h4>
<div class="row my-3">
<div class="col">
<table class="border w-100">
<tbody class="border">
{{#each this.fields}}
{{#if ($eq this.question.dataType 'EMBELLISHMENT')}}
{{#if ($notEq this.config.omitFromPdf true )}}
<tr class="border-bottom">
<td class="p-3 border-right" colspan="2">
<h5 class="bold m-0">{{ this.config.plain }}</h5>
</td>
</tr>
{{/if}}
{{ else }}
<tr class="border-bottom no-break-inside">
<td class="p-3 border-right w-40">
<h6 class="bold m-0">{{ this.question.question }}</h6>
</td>
<td class="p-3 w-60">
{{#if ($eq this.question.dataType 'SAMPLE_DECLARATION')}}
{{#unless this.value}}
<div class="mb-2"><em>Left blank</em></div>
{{/unless}} {{#each this.value}} {{ this.title }} -
<em>See appendix</em>
<br /><br />
{{/each}} {{else if ($eq this.question.dataType
'NUMBER_INPUT')}} {{#if this.value.value}} {{
this.value.value }} {{ this.value.unit.unit }} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType 'BOOLEAN')}}
{{#if this.value}}Yes{{else}}No{{/if}} {{else if ($eq
this.question.dataType 'INTERVAL')}} {{#if ($or
this.value.min this.value.max)}} {{ this.value.min }} - {{
this.value.max }} {{#if this.value.unit}} {{
this.value.unit.unit }} {{/if}} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType 'DATE')}}
{{#if this.value}} {{$utcDate this.value}} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'DYNAMIC_MULTIPLE_CHOICE')}} {{#if this.value}} {{$join
this.value ', '}} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'SELECTION_FROM_OPTIONS')}} {{#if this.value}} {{$join
this.value ', '}} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'TEXT_INPUT')}} {{#if this.value}} {{ this.value }}
{{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'RICH_TEXT_INPUT')}} {{#if this.value}} {{{this.value}}}
{{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'INSTRUMENT_PICKER')}} {{#if this.value}} {{{this.value}}}
{{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'FILE_UPLOAD')}} {{!-- {{#if this.value}} {{{$attachment
this.value ../../attachmentsFileMeta}}} {{else}}
<em>Left blank</em>
{{/if}} --}} {{/if}}
</td>
</tr>
{{/if}}
{{/each}}
</tbody>
</table>
</div>
</div>
{{/unless}} {{/each}}
</div>
{{#each questionarySteps}} {{#if ($eq this.topic.title "Proposal text")
}}
<div class="break-before" data-book-index="Proposal Text">
<h4 class="bold" class="my-3">{{ this.topic.title }}</h4>
<div class="row my-3">
<div class="col">
{{#each this.fields}}
<div class="no-break-inside">
{{#if ($eq this.question.dataType 'EMBELLISHMENT')}}
{{#if ($notEq this.config.omitFromPdf true )}}
<h5 class="bold my-3">{{ this.config.plain }}</h5>
{{/if}}
{{ else }}
<div class="no-break-inside">
<h5 class="bold my-3">{{ this.question.question }}</h5>
{{#if ($eq this.question.dataType 'SAMPLE_DECLARATION')}}
{{#unless this.value}}
<div class="mb-2"><em>Left blank</em></div>
{{/unless}} {{#each this.value}} {{ this.title }} -
<em>See appendix</em>
<br /><br />
{{/each}} {{else if ($eq this.question.dataType
'NUMBER_INPUT')}} {{#if this.value.value}} {{ this.value.value
}} {{ this.value.unit.unit }} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType 'BOOLEAN')}}
{{#if this.value}}Yes{{else}}No{{/if}} {{else if ($eq
this.question.dataType 'INTERVAL')}} {{#if ($or this.value.min
this.value.max)}} {{ this.value.min }} - {{ this.value.max }}
{{#if this.value.unit}} {{ this.value.unit.unit }} {{/if}}
{{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType 'DATE')}} {{#if
this.value}} {{$utcDate this.value}} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'DYNAMIC_MULTIPLE_CHOICE')}} {{#if this.value}} {{$join
this.value ', '}} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'SELECTION_FROM_OPTIONS')}} {{#if this.value}} {{$join
this.value ', '}} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType 'TEXT_INPUT')}}
{{#if this.value}} {{ this.value }} {{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'RICH_TEXT_INPUT')}} {{#if this.value}} {{{this.value}}}
{{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType
'INSTRUMENT_PICKER')}} {{#if this.value}} {{{this.value}}}
{{else}}
<em>Left blank</em>
{{/if}} {{else if ($eq this.question.dataType 'FILE_UPLOAD')}}
{{#if this.value}} {{{$attachment this.value
../../attachmentsFileMeta}}} {{else}}
<em>Left blank</em>
{{/if}} {{/if}}
</div>
{{/if}}
</div>
{{/each}}
</div>
</div>
</div>
{{/if}} {{/each}}
<div
class="row mt-4 my-3"
data-book-index="Technical Review"
>
<div class="col">
<h4 class="bold" class="mb-4">Technical Review</h4>
<div class="row my-2">
<div class="col-4 bold">Status:</div>
<div class="col-8">{{ technicalReview.status }}</div>
</div>
<div class="row my-2">
<div class="col-4 bold">Time Allocation:</div>
<div class="col-8">{{ technicalReview.timeAllocation }}</div>
</div>
<div class="row my-2">
<div class="col-4 bold">Comment:</div>
<div class="col-8">{{ technicalReview.publicComment }}</div>
</div>
</div>
</div>
{{#if fapReviews}} {{#each fapReviews}}
<div class="row mt-4 my-3" data-book-index="Fap Reviews">
<div class="col">
<h4 class="bold" class="mb-4">Fap Review {{ $sum @index 1 }}</h4>
<div class="row my-2">
<div class="col-4 bold">Grade:</div>
<div class="col-8">{{ this.grade }}</div>
</div>
<div class="row my-2">
<div class="col-4 bold">Comment:</div>
<div class="col-8">{{ this.comment }}</div>
</div>
</div>
</div>
{{/each}} {{/if}}
</div>
</div>
</body>
<script>
function createIndex(config) {
let indexElements = document.querySelectorAll("[data-book-index]");
let indices = [];
let num = 0;
for (let i = 0; i < indexElements.length; ++i) {
let indexElement = indexElements[i];
// create array with all data-book-index
let indexKey = indexElement.dataset.bookIndex;
let indexKeyFirst = indexKey.slice(0, 1);
let indexParent = indexElement.dataset.bookIndexParent;
indices.push({ indexKey, indexParent });
// create id for span whithout
num++;
if (indexElement.id == '') {
indexElement.id = 'book-index-' + num;
}
}
// create <ul> element for the index
let indexElementDiv = document.querySelector(config.indexElement);
let indexUl = document.createElement('ul');
indexUl.id = 'list-index-generated';
indexElementDiv.appendChild(indexUl);
// create <li> element for the index
indices.forEach((index) => {
// create <li> element for the index
let indexNewLi = document.createElement('li');
indexNewLi.classList.add('list-index-element');
const indexKey = index.indexKey;
const indexParent = index.indexParent;
indexNewLi.dataset.listIndex = indexKey;
if (indexParent) indexNewLi.dataset.listIndexParent = indexParent;
indexUl.appendChild(indexNewLi);
});
let indexLi = document
.getElementById('list-index-generated')
.getElementsByClassName('list-index-element');
for (var n = 0; n < indexLi.length; n++) {
// find data and add HTML of the list
let dataIndex = indexLi[n].dataset.listIndex;
let spanIndex = document.querySelectorAll(
"[data-book-index='" + dataIndex + "']"
);
indexLi[n].innerHTML =
'<span class="index-value">' +
dataIndex +
'</span><span class="links-pages"></span>';
// add span for link page
spanIndex.forEach(function (elem) {
spanIndexId = elem.id;
let spanPage = document.createElement('span');
spanPage.classList.add('link-page');
spanPage.innerHTML = '<a href="#' + spanIndexId + '"></a>';
indexLi[n]
.getElementsByClassName('links-pages')[0]
.appendChild(spanPage);
});
}
}
createIndex({
indexElement: '#bookIndex',
});
</script>
</html>