Browse code

Add property info to asset reader pdf export

Benjamin Roth authored on15/08/2024 11:25:08
Showing1 changed files
... ...
@@ -386,6 +386,52 @@
386 386
                 columnGap: {{ 5|mm2pt }},
387 387
                 unbreakable: true
388 388
             },
389
+            {% if item.hasProperty %}
390
+            {
391
+                text: '{{ 'MSC.re_managed_property_info'|trans({}, 'contao_default') }}',
392
+                style: 'h3',
393
+                pageBreak: 'before'
394
+            },
395
+            {
396
+                table: {
397
+                    widths: ['*'],
398
+                    body: [
399
+                        [
400
+                            {
401
+                                columns: [
402
+                                    {
403
+                                        stack: [
404
+                                            {% if item.property.description %}
405
+                                            {
406
+                                                text: '{{ item.property.description|raw|striptags|replace({ '\r\n': '\\r\\n', '\n': '\\n', '\r': '\\r' }) }}',
407
+                                                margin: [0, 0, 0,0],
408
+                                            }
409
+                                            {% endif %}
410
+                                        ],
411
+                                        width: '*'
412
+                                    },
413
+                                    {
414
+                                        stack: [
415
+                                            {
416
+                                                image: '{{ item.teaserFigure.getImage().getFilePath()|imageDataUrl }}',
417
+                                                fit: [{{ 85|mm2pt }},{{ 85|mm2pt }}],
418
+                                                alignment: 'right'
419
+                                            }
420
+                                        ],
421
+                                        width: '*'
422
+                                    }
423
+                                ],
424
+                                margin: [15, 10, 15, 10],
425
+                                columnGap: {{ 5|mm2pt }}
426
+                            }
427
+                        ]
428
+                    ]
429
+                },
430
+                fillColor: '#e6ebf1',
431
+                layout: 'noBorders',
432
+                margin: [0, 0, 0,{{ 8|mm2pt }}],
433
+            },
434
+            {% endif %}
389 435
             {% if item.floorPlansFigures|length > 0 %}
390 436
             {
391 437
                 text: '{{ 'MSC.re_floorPlan'|trans({}, 'contao_default') }}',
Browse code

Some more adjustments

Benjamin Roth authored on15/04/2024 16:14:33
Showing1 changed files
... ...
@@ -223,8 +223,9 @@
223 223
                                                         table: {
224 224
                                                             widths: ['40%', '*'],
225 225
                                                             body: [
226
-                                                                {{ _self.tableRow('tl_vr_real_estate_assets.coldRent.0'|trans({}, 'contao_default'),item.coldRent|number_format(2, ',', ''),{ append: ' €'}) }}
227
-                                                                {{ _self.tableRow('tl_vr_real_estate_assets.advanceOperatingCosts.0'|trans({}, 'contao_default')|replace({'­' : '-'}),item.advanceOperatingCosts|number_format(2, ',', ''),{ append: ' €'}) }}
226
+                                                                {% if item.coldRent > 0 %}{{ _self.tableRow('tl_vr_real_estate_assets.coldRent.0'|trans({}, 'contao_default'),item.coldRent|number_format(2, ',', ''),{ append: ' €'}) }}{% endif %}
227
+                                                                {% if item.advanceOperatingCosts > 0 %}{{ _self.tableRow('tl_vr_real_estate_assets.advanceOperatingCosts.0'|trans({}, 'contao_default')|replace({'­' : '-'}),item.advanceOperatingCosts|number_format(2, ',', ''),{ append: ' €'}) }}{% endif %}
228
+                                                                {% if item.rent > 0 %}{{ _self.tableRow('tl_vr_real_estate_assets.rent.0'|trans({}, 'contao_default')|replace({'­' : '-'}),item.rent|number_format(2, ',', ''),{ append: ' €'}) }}{% endif %}
228 229
                                                             ],
229 230
                                                         },
230 231
                                                         layout: 'noBorders',
... ...
@@ -251,11 +252,12 @@
251 252
                             },
252 253
                         ],
253 254
                         width: '*',
254
-                    }{% if item.features is iterable  and item.features|length > 0 %},
255
+                    }{% if item.features is iterable  and item.features|length > 0 or item.parking is iterable  and item.parking|length > 0 %},
255 256
                     {
256 257
                         stack: [
258
+                            {% if item.parking is iterable and item.parking|length > 0 %}
257 259
                             {
258
-                                text: '{{ 'MSC.re_features'|trans({}, 'contao_default') }}',
260
+                                text: '{{ 'MSC.re_parking'|trans({}, 'contao_default') }}',
259 261
                                 style: 'h3'
260 262
                             },
261 263
                             {
... ...
@@ -269,8 +271,8 @@
269 271
                                                         table: {
270 272
                                                             widths: [10, '*'],
271 273
                                                             body: [
272
-                                                                {% for feature in item.features %}
273
-                                                                {% set featureTrans = 'REF.re_features.' ~ feature %}
274
+                                                                {% for spot in item.parking %}
275
+                                                                {% set parkingTrans = 'REF.re_parking.' ~ spot %}
274 276
                                                                 [
275 277
                                                                     {
276 278
                                                                         canvas: [
... ...
@@ -295,7 +297,7 @@
295 297
                                                                         ]
296 298
                                                                     },
297 299
                                                                     {
298
-                                                                        text: '{{ featureTrans|trans({}, 'contao_default') }}',
300
+                                                                        text: '{{ parkingTrans|trans({}, 'contao_default') }}',
299 301
                                                                         // color: '#357792'
300 302
                                                                     }
301 303
                                                                 ],
... ...
@@ -312,7 +314,70 @@
312 314
                                 },
313 315
                                 fillColor: '#e6ebf1',
314 316
                                 layout: 'noBorders',
317
+                                margin: [0,0,0,10],
315 318
                             },
319
+                            {% endif %}
320
+                            {% if item.features is iterable and item.features|length > 0 %}
321
+                                {
322
+                                    text: '{{ 'MSC.re_features'|trans({}, 'contao_default') }}',
323
+                                    style: 'h3'
324
+                                },
325
+                                {
326
+                                    table: {
327
+                                        widths: ['*'],
328
+                                        body: [
329
+                                            [
330
+                                                {
331
+                                                    stack: [
332
+                                                        {
333
+                                                            table: {
334
+                                                                widths: [10, '*'],
335
+                                                                body: [
336
+                                                                    {% for feature in item.features %}
337
+                                                                    {% set featureTrans = 'REF.re_features.' ~ feature %}
338
+                                                                    [
339
+                                                                        {
340
+                                                                            canvas: [
341
+                                                                                {
342
+                                                                                    type: 'ellipse',
343
+                                                                                    x: 5, y: 6,
344
+                                                                                    lineColor: 'black',
345
+                                                                                    lineWidth: 1,
346
+                                                                                    r1: 5, r2: 5
347
+                                                                                },
348
+                                                                                {
349
+                                                                                    type: 'polyline',
350
+                                                                                    lineWidth: 1,
351
+                                                                                    closePath: false,
352
+                                                                                    points: [
353
+                                                                                        {x: 3, y: 5},
354
+                                                                                        {x: 5, y: 8},
355
+                                                                                        {x: 10, y: 1}
356
+                                                                                    ],
357
+                                                                                    lineColor: '#1476BB'
358
+                                                                                }
359
+                                                                            ]
360
+                                                                        },
361
+                                                                        {
362
+                                                                            text: '{{ featureTrans|trans({}, 'contao_default') }}',
363
+                                                                            // color: '#357792'
364
+                                                                        }
365
+                                                                    ],
366
+                                                                    {% endfor %}
367
+                                                                ],
368
+                                                            },
369
+                                                            layout: 'noBorders',
370
+                                                            margin: [15, 10, 15, 10],
371
+                                                        },
372
+                                                    ]
373
+                                                }
374
+                                            ]
375
+                                        ]
376
+                                    },
377
+                                    fillColor: '#e6ebf1',
378
+                                    layout: 'noBorders',
379
+                                },
380
+                            {% endif %}
316 381
                         ],
317 382
                         width: '*'
318 383
                     }{% endif %}
Browse code

Some adjustments

Benjamin Roth authored on15/04/2024 12:38:33
Showing1 changed files
... ...
@@ -1,103 +1,126 @@
1 1
 {%- macro tableRow(label, value, options = {}) -%}
2
-  {%- set class = options.class|default({}) -%}
3
-  {%- set prepend = options.prepend|default({}) %}
4
-  {% set append = options.append|default({}) -%}
5
-  {% apply spaceless %}
6
-    {% if label and value %}
7
-      [
8
-{#        { text: '{{- label -}}', color: '#357792' },#}
9
-        { text: '{{- label -}}' },
10
-{#        { text: '{% if prepend %}{{ prepend }}{% endif %}{{- value -}}{% if append %}{{ append }}{% endif %}', color: '#001118', bold: true },#}
11
-        { text: '{% if prepend %}{{ prepend }}{% endif %}{{- value -}}{% if append %}{{ append }}{% endif %}', bold: true },
12
-      ],
13
-    {% endif %}
14
-  {% endapply %}
2
+    {%- set class = options.class|default({}) -%}
3
+    {%- set prepend = options.prepend|default({}) %}
4
+    {% set append = options.append|default({}) -%}
5
+    {% apply spaceless %}
6
+        {% if label and value %}
7
+            [
8
+            {#        { text: '{{- label -}}', color: '#357792' }, #}
9
+            { text: '{{- label -}}' },
10
+            {#        { text: '{% if prepend %}{{ prepend }}{% endif %}{{- value -}}{% if append %}{{ append }}{% endif %}', color: '#001118', bold: true }, #}
11
+            { text: '{% if prepend %}{{ prepend }}{% endif %}{{- value -}}{% if append %}{{ append }}{% endif %}', bold: true },
12
+            ],
13
+        {% endif %}
14
+    {% endapply %}
15 15
 {%- endmacro -%}
16 16
 
17
-{#<div id="iFrameContainer"></div>#}
17
+{# <div id="iFrameContainer"></div> #}
18 18
 
19 19
 <script src="/bundles/vonrotenbergrealestatelisting/js/pdfmake.js"></script>
20 20
 <script src="/bundles/vonrotenbergrealestatelisting/js/vfs_fonts.js"></script>
21 21
 
22 22
 <script>
23
-  var docDefinition = {
24
-    pageSize: 'A4',
25
-    pageOrientation: 'portrait',
26
-    pageMargins: [{{ 15|mm2pt }},{{ 35|mm2pt }},{{ 15|mm2pt }},{{ 15|mm2pt }}],
27
-    defaultStyle: {
28
-      font: 'Roboto',
29
-      fontSize: 11,
30
-      lineHeight: 1.1
31
-    },
32
-    styles:{
33
-      h3: {
34
-        fontSize: 13,
35
-        bold: true,
36
-        margin: [0,0,0,{{ 1.25|mm2pt }}]
37
-      },
38
-      h4: {
39
-        fontSize: 13,
40
-        // color: '#025577',
41
-        margin: [0,0,0,{{ 1.25|mm2pt }}]
42
-      }
43
-    },
44
-    header: function(currentPage, pageCount, pageSize) {
45
-      if (currentPage === 1)
46
-      {
47
-        return [
48
-          {
49
-            stack: [
50
-              { image: '{{ 'bundles/vonrotenbergrealestatelisting/images/pdf_logo.png'|imageDataUrl }}', width: {{ 35|mm2pt }}, alignment: 'center'},
51
-            ],
52
-            margin: [{{ 15|mm2pt }},{{ 5|mm2pt }},{{ 15|mm2pt }},0]
53
-          },
54
-        ];
55
-      }
56
-      return [];
57
-    },
58
-    footer: function(currentPage, pageCount, pageSize) {
59
-      if (pageCount > 1)
60
-      {
61
-        return [
62
-          {
63
-            stack: [
64
-              { text: 'Seite: '+currentPage+'/'+pageCount, alignment: 'right', margin: [0, 0, 0, 0], color: '#666'}
65
-            ],
66
-            margin: [{{ 15|mm2pt }},{{ 5|mm2pt }},{{ 15|mm2pt }},0]
67
-          },
68
-        ];
69
-      }
70
-      return [];
71
-    },
72
-    content: [
73
-      {
74
-        columns: [
75
-          {
76
-            stack: [
77
-              {
78
-                text: '{{ item.title }}{% if item.city %} in {{ item.city }}{% endif %}',
79
-                fontSize: 20,
80
-                margin: [0,0,0,{{ 2.5|mm2pt }}],
81
-                color: '#025577'
82
-              },
83
-              {% if item.address %}
84
-                {
85
-                  text: '{{ item.address }}',
86
-                  fontSize: 16,
87
-                  margin: [0,0,0,{{ 2.5|mm2pt }}]
88
-                },
89
-              {% endif %}
90
-              {
91
-                text: 'Objekt-Nr.: {{ item.assetNo }}',
92
-                fontSize: 14,
93
-                color: '#025577',
94
-                margin: [0,0,0,{{ 5|mm2pt }}]
95
-              },
96
-              {
97
-                qr: '{{ item.qrUrl }}',
98
-                fit: 70
99
-              }
100
-              {#{% if item.description %}
23
+    var docDefinition = {
24
+        pageSize: 'A4',
25
+        pageOrientation: 'portrait',
26
+        pageMargins: [{{ 15|mm2pt }},{{ 35|mm2pt }},{{ 15|mm2pt }},{{ 15|mm2pt }}],
27
+        info: {
28
+            title: 'riel-expose-nr_{{ item.assetNo }}-{{ "now"|date("Y-m-d") }}',
29
+            author: 'vonRotenberg Estate Manager',
30
+            creator: 'vonRotenberg Estate Manager',
31
+            producer: 'vonRotenberg Estate Manager',
32
+            subject: 'Expose für Objekt-Nr. {{ item.assetNo }}'
33
+        },
34
+        defaultStyle: {
35
+            font: 'Roboto',
36
+            fontSize: 11,
37
+            lineHeight: 1.1
38
+        },
39
+        styles: {
40
+            h3: {
41
+                fontSize: 13,
42
+                bold: true,
43
+                margin: [0, 0, 0,{{ 1.25|mm2pt }}]
44
+            },
45
+            h4: {
46
+                fontSize: 13,
47
+                // color: '#1476BB',
48
+                margin: [0, 0, 0,{{ 1.25|mm2pt }}]
49
+            }
50
+        },
51
+        header: function (currentPage, pageCount, pageSize) {
52
+            if (currentPage === 1)
53
+            {
54
+                return [
55
+                    {
56
+                        stack: [
57
+                            {
58
+                                image: '{{ 'bundles/vonrotenbergrealestatelisting/images/pdf_logo.png'|imageDataUrl }}',
59
+                                width: {{ 35|mm2pt }},
60
+                                alignment: 'center'
61
+                            },
62
+                        ],
63
+                        margin: [{{ 15|mm2pt }},{{ 5|mm2pt }},{{ 15|mm2pt }}, 0]
64
+                    },
65
+                ];
66
+            }
67
+            return [];
68
+        },
69
+        footer: function (currentPage, pageCount, pageSize) {
70
+            if (pageCount > 1)
71
+            {
72
+                return [
73
+                    {
74
+                        stack: [
75
+                            {
76
+                                text: 'Seite: ' + currentPage + '/' + pageCount,
77
+                                alignment: 'right',
78
+                                margin: [0, 0, 0, 0],
79
+                                color: '#666'
80
+                            }
81
+                        ],
82
+                        margin: [{{ 15|mm2pt }},{{ 5|mm2pt }},{{ 15|mm2pt }}, 0]
83
+                    },
84
+                ];
85
+            }
86
+            return [];
87
+        },
88
+        content: [
89
+            {
90
+                columns: [
91
+                    {
92
+                        stack: [
93
+                            {
94
+                                text: '{{ item.title }}',
95
+                                fontSize: 20,
96
+                                margin: [0, 0, 0,{{ 2.5|mm2pt }}],
97
+                                color: '#1476BB'
98
+                            },
99
+                            {% if item.address %}
100
+                            {
101
+                                text: '{{ item.address }}',
102
+                                fontSize: 16,
103
+                                margin: [0, 0, 0, 0]
104
+                            },
105
+                            {% endif %}
106
+                            {% if item.city and item.postal %}
107
+                            {
108
+                                text: '{{ item.postal }} {{ item.city }}',
109
+                                fontSize: 16,
110
+                                margin: [0, 0, 0, 0]
111
+                            },
112
+                            {% endif %}
113
+                            {
114
+                                text: 'Objekt-Nr.: {{ item.assetNo }}',
115
+                                fontSize: 14,
116
+                                color: '#1476BB',
117
+                                margin: [0, {{ 2.5|mm2pt }}, 0,{{ 5|mm2pt }}]
118
+                            },
119
+                            {
120
+                                qr: '{{ item.qrUrl }}',
121
+                                fit: 80
122
+                            }
123
+                            {# {% if item.description %}
101 124
               {
102 125
                 text: '{{ 'MSC.re_description'|trans({}, 'contao_default') }}',
103 126
                 style: 'h3',
... ...
@@ -107,244 +130,254 @@
107 130
                 text: '{{ item.description|raw|striptags }}',
108 131
                 margin: [0, 0, 0,{{ 10|mm2pt }}],
109 132
               }
110
-              {% endif %}#}
111
-            ],
112
-            width: '*'
113
-          },
114
-          {
115
-            stack: [
116
-              {
117
-                image: '{{ item.teaserFigure.getImage().getFilePath()|imageDataUrl }}',
118
-                fit: [{{ 85|mm2pt }},{{ 85|mm2pt }}],
119
-                alignment: 'right'
120
-              }
121
-            ],
122
-            width: '*'
123
-          }
124
-        ],
125
-        margin: [0,0,0,{{ 10|mm2pt }}],
126
-        columnGap: {{ 5|mm2pt }}
127
-      },
128
-      {% if item.description %}
129
-      {
130
-        text: '{{ 'MSC.re_description'|trans({}, 'contao_default') }}',
131
-        style: 'h3'
132
-      },
133
-      {
134
-        table: {
135
-          widths: ['*'],
136
-          body: [
137
-            [
138
-              {
139
-                text: '{{ item.description|raw|striptags|replace({ '\r\n': '\\r\\n', '\n': '\\n', '\r': '\\r' }) }}',
140
-                margin: [5,5,5,5],
141
-                // color: '#357792'
142
-              }
143
-            ]
144
-          ]
145
-        },
146
-        fillColor: '#f3fbff',
147
-        layout: 'noBorders',
148
-        margin: [0, 0, 0,{{ 10|mm2pt }}],
149
-      },
150
-      {% endif %}
151
-      {
152
-        columns: [
153
-          {
154
-            stack: [
155
-              {
156
-                text: '{{ 'MSC.re_properties'|trans({}, 'contao_default') }}',
133
+              {% endif %} #}
134
+                        ],
135
+                        width: '*'
136
+                    },
137
+                    {
138
+                        stack: [
139
+                            {
140
+                                image: '{{ item.teaserFigure.getImage().getFilePath()|imageDataUrl }}',
141
+                                fit: [{{ 85|mm2pt }},{{ 85|mm2pt }}],
142
+                                alignment: 'right'
143
+                            }
144
+                        ],
145
+                        width: '*'
146
+                    }
147
+                ],
148
+                margin: [0, 0, 0,{{ 10|mm2pt }}],
149
+                columnGap: {{ 5|mm2pt }}
150
+            },
151
+            {% if item.description %}
152
+            {
153
+                text: '{{ 'MSC.re_description'|trans({}, 'contao_default') }}',
157 154
                 style: 'h3'
158
-              },
159
-              {
155
+            },
156
+            {
160 157
                 table: {
161
-                  widths: ['*'],
162
-                  body: [
163
-                    [
164
-                      {
165
-                        stack: [
166
-                          {
167
-                            table: {
168
-                              widths: ['40%', '*'],
169
-                              body: [
170
-                                {{ _self.tableRow('tl_vr_real_estate_assets.livingSpace.0'|trans({}, 'contao_default'),item.livingSpace|number_format(2, ',', ''),{ append: ' m²'}) }}
171
-                                {{ _self.tableRow('tl_vr_real_estate_assets.numberOfRooms.0'|trans({}, 'contao_default'),item.numberOfRooms) }}
172
-                                {% set condition = 'REF.re_condition.' ~ item.condition %}
173
-                                {{ _self.tableRow('tl_vr_real_estate_assets.condition.0'|trans({}, 'contao_default'),condition|trans({}, 'contao_default')) }}
174
-                                {{ _self.tableRow('tl_vr_real_estate_assets.constructionYear.0'|trans({}, 'contao_default'),item.constructionYear) }}
175
-                              ],
176
-                            },
177
-                            layout: 'noBorders',
178
-                            margin: [5, 5, 5, 5],
179
-                          },
180
-                          {
181
-                            table: {
182
-                              widths: ['40%', '*'],
183
-                              body: [
184
-                                {% set heating = 'REF.re_heatingType.' ~ item.heatingType %}
185
-                                {{ _self.tableRow('tl_vr_real_estate_assets.heatingType.0'|trans({}, 'contao_default'),heating|trans({}, 'contao_default')) }}
186
-                                {% if item.energyConsumption and item.energyPassType %}
187
-                                  {% set passType = 'REF.re_energyPassType.' ~ item.energyPassType %}
188
-                                  {{ _self.tableRow('MSC.re_energyConsumption'|trans({}, 'contao_default') ~ ' ' ~ passType|trans({}, 'contao_default'),item.energyConsumption,{ append: ' kWh/(m²a)'}) }}
189
-                                {% endif %}
190
-                              ],
191
-                            },
192
-                            layout: 'noBorders',
193
-                            margin: [5, 5, 5, 5],
194
-                          },
195
-                          {
196
-                            text: '{{ 'MSC.re_rent'|trans({}, 'contao_default') }}',
197
-                            style: 'h4',
198
-                            margin: [5, 5, 5, 5],
199
-                          },
200
-                          {
201
-                            table: {
202
-                              widths: ['40%', '*'],
203
-                              body: [
204
-                                {{ _self.tableRow('tl_vr_real_estate_assets.coldRent.0'|trans({}, 'contao_default'),item.coldRent|number_format(2, ',', ''),{ append: ' €'}) }}
205
-                                {{ _self.tableRow('Betriebskosten-vorauszahlungen',item.advanceOperatingCosts|number_format(2, ',', ''),{ append: ' €'}) }}
206
-                              ],
207
-                            },
208
-                            layout: 'noBorders',
209
-                            margin: [5, 5, 5, 5],
210
-                          },
211
-                          {
212
-                            table: {
213
-                              widths: ['40%', '*'],
214
-                              body: [
215
-                                {{ _self.tableRow('Genossenschafts-anteile',item.cooperativeShares) }}
216
-                                {{ _self.tableRow('tl_vr_real_estate_assets.availability.0'|trans({}, 'contao_default'),item.availableFrom) }}
217
-                              ],
218
-                            },
219
-                            layout: 'noBorders',
220
-                            margin: [5, 5, 5, 5],
221
-                          },
158
+                    widths: ['*'],
159
+                    body: [
160
+                        [
161
+                            {
162
+                                text: '{{ item.description|raw|striptags|replace({ '\r\n': '\\r\\n', '\n': '\\n', '\r': '\\r' }) }}',
163
+                                margin: [15, 10, 15, 10],
164
+                                // color: '#357792'
165
+                            }
222 166
                         ]
223
-                      }
224 167
                     ]
225
-                  ]
226 168
                 },
227
-                fillColor: '#f3fbff',
169
+                fillColor: '#e6ebf1',
228 170
                 layout: 'noBorders',
229
-              },
230
-            ],
231
-            width: '*',
232
-          }{% if item.features is iterable  and item.features|length > 0 %},
233
-          {
234
-            stack: [
235
-              {
236
-                text: '{{ 'MSC.re_features'|trans({}, 'contao_default') }}',
237
-                style: 'h3'
238
-              },
239
-              {
240
-                table: {
241
-                  widths: ['*'],
242
-                  body: [
243
-                    [
244
-                      {
171
+                margin: [0, 0, 0,{{ 8|mm2pt }}],
172
+            },
173
+            {% endif %}
174
+            {
175
+                columns: [
176
+                    {
245 177
                         stack: [
246
-                          {
247
-                            table: {
248
-                              widths: [10, '*'],
249
-                              body: [
250
-                                {% for feature in item.features %}
251
-                                {% set featureTrans = 'REF.re_features.' ~ feature %}
252
-                                [
253
-                                  {
254
-                                    canvas: [
255
-                                      {
256
-                                        type: 'polyline',
257
-                                        lineWidth: 1,
258
-                                        closePath: false,
259
-                                        points: [{x: 0, y: 6}, {x: 4, y: 10}, {x: 10, y: 2}],
260
-                                        lineColor: '#73160E'
261
-                                      }
178
+                            {
179
+                                text: '{{ 'MSC.re_properties'|trans({}, 'contao_default') }}',
180
+                                style: 'h3'
181
+                            },
182
+                            {
183
+                                table: {
184
+                                    widths: ['*'],
185
+                                    body: [
186
+                                        [
187
+                                            {
188
+                                                stack: [
189
+                                                    {
190
+                                                        table: {
191
+                                                            widths: ['40%', '*'],
192
+                                                            body: [
193
+                                                                {% if item.livingSpace is defined and item.livingSpace is not empty %}{{ _self.tableRow('tl_vr_real_estate_assets.livingSpace.0'|trans({}, 'contao_default'),item.livingSpace|number_format(2, ',', ''),{ append: ' m²'}) }}{% endif %}
194
+                                                                {% if item.numberOfRooms is defined and item.numberOfRooms is not empty %}{{ _self.tableRow('tl_vr_real_estate_assets.numberOfRooms.0'|trans({}, 'contao_default'),item.numberOfRooms) }}{% endif %}
195
+                                                                {% if item.condition is defined and item.condition is not empty %}{{ _self.tableRow('tl_vr_real_estate_assets.condition.0'|trans({}, 'contao_default'),('REF.re_condition.' ~ item.condition)|trans({}, 'contao_default')) }}{% endif %}
196
+                                                                {% if item.constructionYear is defined and item.constructionYear is not empty %}{{ _self.tableRow('tl_vr_real_estate_assets.constructionYear.0'|trans({}, 'contao_default'),item.constructionYear) }}{% endif %}
197
+                                                            ],
198
+                                                        },
199
+                                                        layout: 'noBorders',
200
+                                                        margin: [15, 10, 15, 5],
201
+                                                    },
202
+                                                    {% if item.heatingType is not empty and item.energyConsumption is not empty and item.energyPassType is not empty %}
203
+                                                    {
204
+                                                        table: {
205
+                                                            widths: ['40%', '*'],
206
+                                                            body: [
207
+                                                                {% if item.heatingType is defined and item.heatingType is not empty %}{{ _self.tableRow('tl_vr_real_estate_assets.heatingType.0'|trans({}, 'contao_default'),('REF.re_heatingType.' ~ item.heatingType)|trans({}, 'contao_default')) }}{% endif %}
208
+                                                                {% if item.energyConsumption and item.energyPassType %}
209
+                                                                {{ _self.tableRow('MSC.re_energyConsumption'|trans({}, 'contao_default')|replace({'&shy;' : '-'}) ~ ' ' ~ ('REF.re_energyPassType.' ~ item.energyPassType)|trans({}, 'contao_default'),item.energyConsumption,{ append: ' kWh/(m²a)'}) }}
210
+                                                                {% endif %}
211
+                                                            ],
212
+                                                        },
213
+                                                        layout: 'noBorders',
214
+                                                        margin: [15, 5, 15, 5],
215
+                                                    },
216
+                                                    {% endif %}
217
+                                                    {
218
+                                                        text: '{{ 'MSC.re_rent'|trans({}, 'contao_default') }}',
219
+                                                        style: 'h4',
220
+                                                        margin: [15, 5, 15, 5],
221
+                                                    },
222
+                                                    {
223
+                                                        table: {
224
+                                                            widths: ['40%', '*'],
225
+                                                            body: [
226
+                                                                {{ _self.tableRow('tl_vr_real_estate_assets.coldRent.0'|trans({}, 'contao_default'),item.coldRent|number_format(2, ',', ''),{ append: ' €'}) }}
227
+                                                                {{ _self.tableRow('tl_vr_real_estate_assets.advanceOperatingCosts.0'|trans({}, 'contao_default')|replace({'&shy;' : '-'}),item.advanceOperatingCosts|number_format(2, ',', ''),{ append: ' €'}) }}
228
+                                                            ],
229
+                                                        },
230
+                                                        layout: 'noBorders',
231
+                                                        margin: [15, 5, 15, 5],
232
+                                                    },
233
+                                                    {
234
+                                                        table: {
235
+                                                            widths: ['40%', '*'],
236
+                                                            body: [
237
+                                                                {{ _self.tableRow('tl_vr_real_estate_assets.deposit.0'|trans({}, 'contao_default')|replace({'&shy;' : '-'}),item.deposit|number_format(2, ',', ''),{ append: ' €'}) }}
238
+                                                                {{ _self.tableRow('tl_vr_real_estate_assets.availability.0'|trans({}, 'contao_default'),item.availableFrom) }}
239
+                                                            ],
240
+                                                        },
241
+                                                        layout: 'noBorders',
242
+                                                        margin: [15, 5, 15, 10],
243
+                                                    },
244
+                                                ]
245
+                                            }
246
+                                        ]
262 247
                                     ]
263
-                                  },
264
-                                  {
265
-                                    text: '{{ featureTrans|trans({}, 'contao_default') }}',
266
-                                    // color: '#357792'
267
-                                  }
268
-                                ],
269
-                                {% endfor %}
270
-                              ],
248
+                                },
249
+                                fillColor: '#e6ebf1',
250
+                                layout: 'noBorders',
271 251
                             },
272
-                            layout: 'noBorders',
273
-                            margin: [5, 5, 5, 5],
274
-                          },
275
-                        ]
276
-                      }
277
-                    ]
278
-                  ]
279
-                },
280
-                fillColor: '#f3fbff',
281
-                layout: 'noBorders',
282
-              },
283
-            ],
284
-            width: '*'
285
-          }{% endif %}
286
-        ],
287
-        margin: [0,0,0,{{ 10|mm2pt }}],
288
-        columnGap: {{ 5|mm2pt }},
289
-        unbreakable: true
290
-      },
291
-      {% if item.floorPlansFigures|length > 0 %}
292
-        {
293
-          text: '{{ 'MSC.re_floorPlan'|trans({}, 'contao_default') }}',
294
-          style: 'h3',
295
-          pageBreak: 'before'
296
-        },
297
-        {% for image in item.floorPlansFigures %}
298
-        {
299
-          image: '{{ image.getImage().getFilePath()|imageDataUrl }}',
300
-          fit: [{{ 180|mm2pt }},{{ 180|mm2pt }}],
301
-          alignment: 'center'
302
-        },
303
-        {% endfor %}
304
-      {% endif %}
305
-      {% if item.galleryFigures|length > 1 %}
306
-        {
307
-          text: '{{ 'MSC.re_gallery'|trans({}, 'contao_default') }}',
308
-          style: 'h3',
309
-          pageBreak: 'before'
310
-        },
311
-        {
312
-          columns: [
313
-            {% for image in item.galleryFigures[1:] %}
314
-            {% if loop.index % 2 > 0 and loop.index > 1 %}
252
+                        ],
253
+                        width: '*',
254
+                    }{% if item.features is iterable  and item.features|length > 0 %},
255
+                    {
256
+                        stack: [
257
+                            {
258
+                                text: '{{ 'MSC.re_features'|trans({}, 'contao_default') }}',
259
+                                style: 'h3'
260
+                            },
261
+                            {
262
+                                table: {
263
+                                    widths: ['*'],
264
+                                    body: [
265
+                                        [
266
+                                            {
267
+                                                stack: [
268
+                                                    {
269
+                                                        table: {
270
+                                                            widths: [10, '*'],
271
+                                                            body: [
272
+                                                                {% for feature in item.features %}
273
+                                                                {% set featureTrans = 'REF.re_features.' ~ feature %}
274
+                                                                [
275
+                                                                    {
276
+                                                                        canvas: [
277
+                                                                            {
278
+                                                                                type: 'ellipse',
279
+                                                                                x: 5, y: 6,
280
+                                                                                lineColor: 'black',
281
+                                                                                lineWidth: 1,
282
+                                                                                r1: 5, r2: 5
283
+                                                                            },
284
+                                                                            {
285
+                                                                                type: 'polyline',
286
+                                                                                lineWidth: 1,
287
+                                                                                closePath: false,
288
+                                                                                points: [
289
+                                                                                    {x: 3, y: 5},
290
+                                                                                    {x: 5, y: 8},
291
+                                                                                    {x: 10, y: 1}
292
+                                                                                ],
293
+                                                                                lineColor: '#1476BB'
294
+                                                                            }
295
+                                                                        ]
296
+                                                                    },
297
+                                                                    {
298
+                                                                        text: '{{ featureTrans|trans({}, 'contao_default') }}',
299
+                                                                        // color: '#357792'
300
+                                                                    }
301
+                                                                ],
302
+                                                                {% endfor %}
303
+                                                            ],
304
+                                                        },
305
+                                                        layout: 'noBorders',
306
+                                                        margin: [15, 10, 15, 10],
307
+                                                    },
308
+                                                ]
309
+                                            }
310
+                                        ]
311
+                                    ]
312
+                                },
313
+                                fillColor: '#e6ebf1',
314
+                                layout: 'noBorders',
315
+                            },
316
+                        ],
317
+                        width: '*'
318
+                    }{% endif %}
315 319
                 ],
320
+                margin: [0, 0, 0,{{ 8|mm2pt }}],
316 321
                 columnGap: {{ 5|mm2pt }},
317
-                margin: [0,0,0,{{ 5|mm2pt }}],
318
-              },
319
-              {
320
-                columns: [
321
-            {% endif %}
322
+                unbreakable: true
323
+            },
324
+            {% if item.floorPlansFigures|length > 0 %}
325
+            {
326
+                text: '{{ 'MSC.re_floorPlan'|trans({}, 'contao_default') }}',
327
+                style: 'h3',
328
+                pageBreak: 'before'
329
+            },
330
+            {% for image in item.floorPlansFigures %}
322 331
             {
323
-              image: '{{ image.getImage().getFilePath()|imageDataUrl }}',
324
-              width: {{ 85|mm2pt }},
325
-              alignment: 'left'
332
+                image: '{{ image.getImage().getFilePath()|imageDataUrl }}',
333
+                fit: [{{ 180|mm2pt }},{{ 180|mm2pt }}],
334
+                alignment: 'center'
326 335
             },
327 336
             {% endfor %}
328
-          ],
329
-          columnGap: {{ 5|mm2pt }}
337
+            {% endif %}
338
+            {% if item.galleryFigures|length > 1 %}
339
+            {
340
+                text: '{{ 'MSC.re_gallery'|trans({}, 'contao_default') }}',
341
+                style: 'h3',
342
+                pageBreak: 'before'
343
+            },
344
+            {
345
+                columns: [
346
+                    {% for image in item.galleryFigures[1:] %}
347
+                    {% if loop.index % 2 > 0 and loop.index > 1 %}
348
+                ],
349
+                columnGap: {{ 5|mm2pt }},
350
+                margin: [0, 0, 0,{{ 5|mm2pt }}],
351
+            },
352
+            {
353
+                columns: [
354
+                    {% endif %}
355
+                    {
356
+                        image: '{{ image.getImage().getFilePath()|imageDataUrl }}',
357
+                        width: {{ 85|mm2pt }},
358
+                        alignment: 'left'
359
+                    },
360
+                    {% endfor %}
361
+                ],
362
+                columnGap: {{ 5|mm2pt }}
363
+            }
364
+            {% endif %}
365
+        ],
366
+        pageBreakBefore(currentNode, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage) {
367
+            return currentNode.pageNumbers.length > 1 && currentNode.unbreakable;
330 368
         }
331
-      {% endif %}
332
-    ],
333
-    pageBreakBefore(currentNode, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage) {
334
-      return currentNode.pageNumbers.length > 1 && currentNode.unbreakable;
335
-    }
336
-  };
337
-  const pdfDocGenerator = pdfMake.createPdf(docDefinition);
369
+    };
370
+    const pdfDocGenerator = pdfMake.createPdf(docDefinition);
338 371
 
339
-  /*pdfDocGenerator.getDataUrl((dataUrl) => {
340
-    const targetElement = document.querySelector('#iframeContainer');
341
-    const iframe = document.createElement('object');
342
-    iframe.data = dataUrl;
343
-    iframe.setAttribute('style','width: 100%; height: 80vh;');
344
-    iframe.setAttribute('type','application/pdf');
345
-    targetElement.appendChild(iframe);
346
-  });*/
347
-  pdfDocGenerator.open();
348
-  {#pdfDocGenerator.download('expose_{{ item.assetNo }}');#}
349
-  // pdfDocGenerator.open({},window);
372
+    /*pdfDocGenerator.getDataUrl((dataUrl) => {
373
+      const targetElement = document.querySelector('#iframeContainer');
374
+      const iframe = document.createElement('object');
375
+      iframe.data = dataUrl;
376
+      iframe.setAttribute('style','width: 100%; height: 80vh;');
377
+      iframe.setAttribute('type','application/pdf');
378
+      targetElement.appendChild(iframe);
379
+    });*/
380
+    // pdfDocGenerator.open();
381
+    {# pdfDocGenerator.download('expose_{{ item.assetNo }}'); #}
382
+    pdfDocGenerator.open({},window);
350 383
 </script>
Browse code

Make reader module Contao 5 compatible

Benjamin Roth authored on28/02/2024 13:01:29
Showing1 changed files
... ...
@@ -16,7 +16,7 @@
16 16
 
17 17
 {#<div id="iFrameContainer"></div>#}
18 18
 
19
-<script src="/bundles/vonrotenbergrealestatelisting/js/pdfmake.min.js"></script>
19
+<script src="/bundles/vonrotenbergrealestatelisting/js/pdfmake.js"></script>
20 20
 <script src="/bundles/vonrotenbergrealestatelisting/js/vfs_fonts.js"></script>
21 21
 
22 22
 <script>
... ...
@@ -47,7 +47,7 @@
47 47
         return [
48 48
           {
49 49
             stack: [
50
-              { image: '{{ 'bundles/vonrotenbergrealestatelisting/images/pdf_logo.png'|imageDataUrl }}', width: {{ 65|mm2pt }}, alignment: 'center'},
50
+              { image: '{{ 'bundles/vonrotenbergrealestatelisting/images/pdf_logo.png'|imageDataUrl }}', width: {{ 35|mm2pt }}, alignment: 'center'},
51 51
             ],
52 52
             margin: [{{ 15|mm2pt }},{{ 5|mm2pt }},{{ 15|mm2pt }},0]
53 53
           },
... ...
@@ -229,7 +229,7 @@
229 229
               },
230 230
             ],
231 231
             width: '*',
232
-          },
232
+          }{% if item.features is iterable  and item.features|length > 0 %},
233 233
           {
234 234
             stack: [
235 235
               {
... ...
@@ -282,7 +282,7 @@
282 282
               },
283 283
             ],
284 284
             width: '*'
285
-          }
285
+          }{% endif %}
286 286
         ],
287 287
         margin: [0,0,0,{{ 10|mm2pt }}],
288 288
         columnGap: {{ 5|mm2pt }},
... ...
@@ -344,6 +344,7 @@
344 344
     iframe.setAttribute('type','application/pdf');
345 345
     targetElement.appendChild(iframe);
346 346
   });*/
347
-  pdfDocGenerator.download('expose_{{ item.assetNo }}');
347
+  pdfDocGenerator.open();
348
+  {#pdfDocGenerator.download('expose_{{ item.assetNo }}');#}
348 349
   // pdfDocGenerator.open({},window);
349 350
 </script>
Browse code

Initial commit

Benjamin Roth authored on26/02/2024 17:53:24
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,349 @@
1
+{%- macro tableRow(label, value, options = {}) -%}
2
+  {%- set class = options.class|default({}) -%}
3
+  {%- set prepend = options.prepend|default({}) %}
4
+  {% set append = options.append|default({}) -%}
5
+  {% apply spaceless %}
6
+    {% if label and value %}
7
+      [
8
+{#        { text: '{{- label -}}', color: '#357792' },#}
9
+        { text: '{{- label -}}' },
10
+{#        { text: '{% if prepend %}{{ prepend }}{% endif %}{{- value -}}{% if append %}{{ append }}{% endif %}', color: '#001118', bold: true },#}
11
+        { text: '{% if prepend %}{{ prepend }}{% endif %}{{- value -}}{% if append %}{{ append }}{% endif %}', bold: true },
12
+      ],
13
+    {% endif %}
14
+  {% endapply %}
15
+{%- endmacro -%}
16
+
17
+{#<div id="iFrameContainer"></div>#}
18
+
19
+<script src="/bundles/vonrotenbergrealestatelisting/js/pdfmake.min.js"></script>
20
+<script src="/bundles/vonrotenbergrealestatelisting/js/vfs_fonts.js"></script>
21
+
22
+<script>
23
+  var docDefinition = {
24
+    pageSize: 'A4',
25
+    pageOrientation: 'portrait',
26
+    pageMargins: [{{ 15|mm2pt }},{{ 35|mm2pt }},{{ 15|mm2pt }},{{ 15|mm2pt }}],
27
+    defaultStyle: {
28
+      font: 'Roboto',
29
+      fontSize: 11,
30
+      lineHeight: 1.1
31
+    },
32
+    styles:{
33
+      h3: {
34
+        fontSize: 13,
35
+        bold: true,
36
+        margin: [0,0,0,{{ 1.25|mm2pt }}]
37
+      },
38
+      h4: {
39
+        fontSize: 13,
40
+        // color: '#025577',
41
+        margin: [0,0,0,{{ 1.25|mm2pt }}]
42
+      }
43
+    },
44
+    header: function(currentPage, pageCount, pageSize) {
45
+      if (currentPage === 1)
46
+      {
47
+        return [
48
+          {
49
+            stack: [
50
+              { image: '{{ 'bundles/vonrotenbergrealestatelisting/images/pdf_logo.png'|imageDataUrl }}', width: {{ 65|mm2pt }}, alignment: 'center'},
51
+            ],
52
+            margin: [{{ 15|mm2pt }},{{ 5|mm2pt }},{{ 15|mm2pt }},0]
53
+          },
54
+        ];
55
+      }
56
+      return [];
57
+    },
58
+    footer: function(currentPage, pageCount, pageSize) {
59
+      if (pageCount > 1)
60
+      {
61
+        return [
62
+          {
63
+            stack: [
64
+              { text: 'Seite: '+currentPage+'/'+pageCount, alignment: 'right', margin: [0, 0, 0, 0], color: '#666'}
65
+            ],
66
+            margin: [{{ 15|mm2pt }},{{ 5|mm2pt }},{{ 15|mm2pt }},0]
67
+          },
68
+        ];
69
+      }
70
+      return [];
71
+    },
72
+    content: [
73
+      {
74
+        columns: [
75
+          {
76
+            stack: [
77
+              {
78
+                text: '{{ item.title }}{% if item.city %} in {{ item.city }}{% endif %}',
79
+                fontSize: 20,
80
+                margin: [0,0,0,{{ 2.5|mm2pt }}],
81
+                color: '#025577'
82
+              },
83
+              {% if item.address %}
84
+                {
85
+                  text: '{{ item.address }}',
86
+                  fontSize: 16,
87
+                  margin: [0,0,0,{{ 2.5|mm2pt }}]
88
+                },
89
+              {% endif %}
90
+              {
91
+                text: 'Objekt-Nr.: {{ item.assetNo }}',
92
+                fontSize: 14,
93
+                color: '#025577',
94
+                margin: [0,0,0,{{ 5|mm2pt }}]
95
+              },
96
+              {
97
+                qr: '{{ item.qrUrl }}',
98
+                fit: 70
99
+              }
100
+              {#{% if item.description %}
101
+              {
102
+                text: '{{ 'MSC.re_description'|trans({}, 'contao_default') }}',
103
+                style: 'h3',
104
+                margin: [0, {{ 10|mm2pt }}, 0, 0],
105
+              },
106
+              {
107
+                text: '{{ item.description|raw|striptags }}',
108
+                margin: [0, 0, 0,{{ 10|mm2pt }}],
109
+              }
110
+              {% endif %}#}
111
+            ],
112
+            width: '*'
113
+          },
114
+          {
115
+            stack: [
116
+              {
117
+                image: '{{ item.teaserFigure.getImage().getFilePath()|imageDataUrl }}',
118
+                fit: [{{ 85|mm2pt }},{{ 85|mm2pt }}],
119
+                alignment: 'right'
120
+              }
121
+            ],
122
+            width: '*'
123
+          }
124
+        ],
125
+        margin: [0,0,0,{{ 10|mm2pt }}],
126
+        columnGap: {{ 5|mm2pt }}
127
+      },
128
+      {% if item.description %}
129
+      {
130
+        text: '{{ 'MSC.re_description'|trans({}, 'contao_default') }}',
131
+        style: 'h3'
132
+      },
133
+      {
134
+        table: {
135
+          widths: ['*'],
136
+          body: [
137
+            [
138
+              {
139
+                text: '{{ item.description|raw|striptags|replace({ '\r\n': '\\r\\n', '\n': '\\n', '\r': '\\r' }) }}',
140
+                margin: [5,5,5,5],
141
+                // color: '#357792'
142
+              }
143
+            ]
144
+          ]
145
+        },
146
+        fillColor: '#f3fbff',
147
+        layout: 'noBorders',
148
+        margin: [0, 0, 0,{{ 10|mm2pt }}],
149
+      },
150
+      {% endif %}
151
+      {
152
+        columns: [
153
+          {
154
+            stack: [
155
+              {
156
+                text: '{{ 'MSC.re_properties'|trans({}, 'contao_default') }}',
157
+                style: 'h3'
158
+              },
159
+              {
160
+                table: {
161
+                  widths: ['*'],
162
+                  body: [
163
+                    [
164
+                      {
165
+                        stack: [
166
+                          {
167
+                            table: {
168
+                              widths: ['40%', '*'],
169
+                              body: [
170
+                                {{ _self.tableRow('tl_vr_real_estate_assets.livingSpace.0'|trans({}, 'contao_default'),item.livingSpace|number_format(2, ',', ''),{ append: ' m²'}) }}
171
+                                {{ _self.tableRow('tl_vr_real_estate_assets.numberOfRooms.0'|trans({}, 'contao_default'),item.numberOfRooms) }}
172
+                                {% set condition = 'REF.re_condition.' ~ item.condition %}
173
+                                {{ _self.tableRow('tl_vr_real_estate_assets.condition.0'|trans({}, 'contao_default'),condition|trans({}, 'contao_default')) }}
174
+                                {{ _self.tableRow('tl_vr_real_estate_assets.constructionYear.0'|trans({}, 'contao_default'),item.constructionYear) }}
175
+                              ],
176
+                            },
177
+                            layout: 'noBorders',
178
+                            margin: [5, 5, 5, 5],
179
+                          },
180
+                          {
181
+                            table: {
182
+                              widths: ['40%', '*'],
183
+                              body: [
184
+                                {% set heating = 'REF.re_heatingType.' ~ item.heatingType %}
185
+                                {{ _self.tableRow('tl_vr_real_estate_assets.heatingType.0'|trans({}, 'contao_default'),heating|trans({}, 'contao_default')) }}
186
+                                {% if item.energyConsumption and item.energyPassType %}
187
+                                  {% set passType = 'REF.re_energyPassType.' ~ item.energyPassType %}
188
+                                  {{ _self.tableRow('MSC.re_energyConsumption'|trans({}, 'contao_default') ~ ' ' ~ passType|trans({}, 'contao_default'),item.energyConsumption,{ append: ' kWh/(m²a)'}) }}
189
+                                {% endif %}
190
+                              ],
191
+                            },
192
+                            layout: 'noBorders',
193
+                            margin: [5, 5, 5, 5],
194
+                          },
195
+                          {
196
+                            text: '{{ 'MSC.re_rent'|trans({}, 'contao_default') }}',
197
+                            style: 'h4',
198
+                            margin: [5, 5, 5, 5],
199
+                          },
200
+                          {
201
+                            table: {
202
+                              widths: ['40%', '*'],
203
+                              body: [
204
+                                {{ _self.tableRow('tl_vr_real_estate_assets.coldRent.0'|trans({}, 'contao_default'),item.coldRent|number_format(2, ',', ''),{ append: ' €'}) }}
205
+                                {{ _self.tableRow('Betriebskosten-vorauszahlungen',item.advanceOperatingCosts|number_format(2, ',', ''),{ append: ' €'}) }}
206
+                              ],
207
+                            },
208
+                            layout: 'noBorders',
209
+                            margin: [5, 5, 5, 5],
210
+                          },
211
+                          {
212
+                            table: {
213
+                              widths: ['40%', '*'],
214
+                              body: [
215
+                                {{ _self.tableRow('Genossenschafts-anteile',item.cooperativeShares) }}
216
+                                {{ _self.tableRow('tl_vr_real_estate_assets.availability.0'|trans({}, 'contao_default'),item.availableFrom) }}
217
+                              ],
218
+                            },
219
+                            layout: 'noBorders',
220
+                            margin: [5, 5, 5, 5],
221
+                          },
222
+                        ]
223
+                      }
224
+                    ]
225
+                  ]
226
+                },
227
+                fillColor: '#f3fbff',
228
+                layout: 'noBorders',
229
+              },
230
+            ],
231
+            width: '*',
232
+          },
233
+          {
234
+            stack: [
235
+              {
236
+                text: '{{ 'MSC.re_features'|trans({}, 'contao_default') }}',
237
+                style: 'h3'
238
+              },
239
+              {
240
+                table: {
241
+                  widths: ['*'],
242
+                  body: [
243
+                    [
244
+                      {
245
+                        stack: [
246
+                          {
247
+                            table: {
248
+                              widths: [10, '*'],
249
+                              body: [
250
+                                {% for feature in item.features %}
251
+                                {% set featureTrans = 'REF.re_features.' ~ feature %}
252
+                                [
253
+                                  {
254
+                                    canvas: [
255
+                                      {
256
+                                        type: 'polyline',
257
+                                        lineWidth: 1,
258
+                                        closePath: false,
259
+                                        points: [{x: 0, y: 6}, {x: 4, y: 10}, {x: 10, y: 2}],
260
+                                        lineColor: '#73160E'
261
+                                      }
262
+                                    ]
263
+                                  },
264
+                                  {
265
+                                    text: '{{ featureTrans|trans({}, 'contao_default') }}',
266
+                                    // color: '#357792'
267
+                                  }
268
+                                ],
269
+                                {% endfor %}
270
+                              ],
271
+                            },
272
+                            layout: 'noBorders',
273
+                            margin: [5, 5, 5, 5],
274
+                          },
275
+                        ]
276
+                      }
277
+                    ]
278
+                  ]
279
+                },
280
+                fillColor: '#f3fbff',
281
+                layout: 'noBorders',
282
+              },
283
+            ],
284
+            width: '*'
285
+          }
286
+        ],
287
+        margin: [0,0,0,{{ 10|mm2pt }}],
288
+        columnGap: {{ 5|mm2pt }},
289
+        unbreakable: true
290
+      },
291
+      {% if item.floorPlansFigures|length > 0 %}
292
+        {
293
+          text: '{{ 'MSC.re_floorPlan'|trans({}, 'contao_default') }}',
294
+          style: 'h3',
295
+          pageBreak: 'before'
296
+        },
297
+        {% for image in item.floorPlansFigures %}
298
+        {
299
+          image: '{{ image.getImage().getFilePath()|imageDataUrl }}',
300
+          fit: [{{ 180|mm2pt }},{{ 180|mm2pt }}],
301
+          alignment: 'center'
302
+        },
303
+        {% endfor %}
304
+      {% endif %}
305
+      {% if item.galleryFigures|length > 1 %}
306
+        {
307
+          text: '{{ 'MSC.re_gallery'|trans({}, 'contao_default') }}',
308
+          style: 'h3',
309
+          pageBreak: 'before'
310
+        },
311
+        {
312
+          columns: [
313
+            {% for image in item.galleryFigures[1:] %}
314
+            {% if loop.index % 2 > 0 and loop.index > 1 %}
315
+                ],
316
+                columnGap: {{ 5|mm2pt }},
317
+                margin: [0,0,0,{{ 5|mm2pt }}],
318
+              },
319
+              {
320
+                columns: [
321
+            {% endif %}
322
+            {
323
+              image: '{{ image.getImage().getFilePath()|imageDataUrl }}',
324
+              width: {{ 85|mm2pt }},
325
+              alignment: 'left'
326
+            },
327
+            {% endfor %}
328
+          ],
329
+          columnGap: {{ 5|mm2pt }}
330
+        }
331
+      {% endif %}
332
+    ],
333
+    pageBreakBefore(currentNode, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage) {
334
+      return currentNode.pageNumbers.length > 1 && currentNode.unbreakable;
335
+    }
336
+  };
337
+  const pdfDocGenerator = pdfMake.createPdf(docDefinition);
338
+
339
+  /*pdfDocGenerator.getDataUrl((dataUrl) => {
340
+    const targetElement = document.querySelector('#iframeContainer');
341
+    const iframe = document.createElement('object');
342
+    iframe.data = dataUrl;
343
+    iframe.setAttribute('style','width: 100%; height: 80vh;');
344
+    iframe.setAttribute('type','application/pdf');
345
+    targetElement.appendChild(iframe);
346
+  });*/
347
+  pdfDocGenerator.download('expose_{{ item.assetNo }}');
348
+  // pdfDocGenerator.open({},window);
349
+</script>