Browse code

Add property info to asset reader

Benjamin Roth authored on07/08/2024 15:23:42
Showing2 changed files
... ...
@@ -123,7 +123,26 @@
123 123
 
124 124
         {{ _self.backgroundWrapper_close }}
125 125
 
126
-        {{ _self.backgroundWrapper_open('-padding') }}
126
+        {% if item.hasProperty %}
127
+            {{ _self.backgroundWrapper_open('-padding-medium') }}
128
+            <h3>Objektinformationen</h3>
129
+            <div class="property-description">
130
+                {% if item.property.description %}
131
+                    <div class="description">{{ item.property.description|raw }}</div>
132
+                {% endif %}
133
+
134
+                {% if item.property.galleryFigures[0] %}
135
+                    {{- studio.figure(item.property.galleryFigures[0], { attr: { class: ('image_container media') }}) -}}
136
+                {% endif %}
137
+            </div>
138
+            {{ _self.backgroundWrapper_close }}
139
+        {% endif %}
140
+
141
+        {% if item.hasProperty %}
142
+            {{ _self.backgroundWrapper_open('-padding -alt-color-1') }}
143
+        {% else %}
144
+            {{ _self.backgroundWrapper_open('-padding') }}
145
+        {% endif %}
127 146
         <p class="overviewLink"><a class="btn btn-outline-primary" href="{{ item.listUrl }}">Zurück zur Übersicht</a></p>
128 147
         {{ _self.backgroundWrapper_close }}
129 148
 
... ...
@@ -79,8 +79,18 @@ class RealEstateAssetsReaderController extends RealEstateAssetsModuleController
79 79
             'listUrl'           => $jumpTo !== null ? $jumpTo->getFrontendUrl() : null,
80 80
             'pdfUrl'            => $request->getBaseUrl() . $request->getPathInfo() . '?pdf',
81 81
             'qrUrl'             => $request->getUriForPath($request->getPathInfo()),
82
+            'hasProperty'       => false
82 83
         ]);
83 84
 
85
+        // Check for object
86
+        if (($Property = $this->asset->getRelated('managedPropertyId')) !== null) {
87
+            $arrItem['hasProperty'] = true;
88
+            $arrItem['property'] = array_merge($Property->row(),[
89
+                'teaserFigure'      => $this->getImageFigures($Property->gallerySRC, $figureBuilder, $Property->orderSRC, 1),
90
+                'galleryFigures'    => $this->getImageFigures($Property->gallerySRC, $figureBuilder, $Property->orderSRC, 0, 0),
91
+            ]);
92
+        }
93
+
84 94
 
85 95
         if (isset($_GET['pdf']))
86 96
         {