Browse code

Update

Benjamin Roth authored on16/08/2023 10:47:52
Showing2 changed files
... ...
@@ -1,37 +1,35 @@
1 1
 <div hx-get="{{ insert_tag('env::request') }}" hx-headers='{"VR-Ajax": "WaSlotsModule"}' hx-trigger="updateWaList from:body, updateWaBooking from:body" class="{{ class }} content-wrapper block"{{ cssID }}{% if style is defined and style is not empty %} style="{{ style }}"{% endif %}>
2 2
 
3 3
     {% block filter %}
4
-        {% if days is defined and days|length %}
5
-            <form hx-get="{{ insert_tag('env::request') }}" hx-push-url="true" hx-headers='{"VR-Ajax": "WaSlotsModule"}' hx-trigger="change, submit" hx-target="closest .content-wrapper" class="filter">
6
-                <div class="row">
7
-                    <div class="col-md-3 kapazitaet">
8
-                        <select name="filter_kapazitaet">
9
-                            <option value="">-</option>
10
-                            {% for option in filter.kapazitaet.options %}
11
-                                <option value="{{ option }}"{% if filter.kapazitaet.selected is defined and filter.kapazitaet.selected == option %} selected{% endif %}>{{ option }}</option>
12
-                            {% endfor %}
13
-                        </select>
14
-                    </div>
15
-                    <div class="col-md-3 sorte">
16
-                        <select name="filter_sorte">
17
-                            <option value="">-</option>
18
-                            {% for key, option in filter.sorte.options %}
19
-                                <option value="{{ key }}"{% if filter.sorte.selected is defined and filter.sorte.selected == key %} selected{% endif %}>{{ option }}</option>
20
-                            {% endfor %}
21
-                        </select>
22
-                    </div>
23
-                    <div class="col-md-3 leseart">
24
-                        <select name="filter_leseart">
25
-                            <option value="">-</option>
26
-                            {% for key, option in filter.leseart.options %}
27
-                                <option value="{{ key }}"{% if filter.leseart.selected is defined and filter.leseart.selected == key %} selected{% endif %}>{{ option }}</option>
28
-                            {% endfor %}
29
-                        </select>
30
-                    </div>
31
-                    <div class="col submit"><button class="u-block w-100p">Filter übernehmen</button></div>
4
+        <form hx-get="{{ pageUrl is defined ? pageUrl : '' }}" hx-push-url="true" hx-headers='{"VR-Ajax": "WaSlotsModule"}' hx-trigger="change, submit" hx-target="closest .content-wrapper" class="filter">
5
+            <div class="row">
6
+                <div class="col-md-3 kapazitaet">
7
+                    <select name="filter_kapazitaet">
8
+                        <option value="">-</option>
9
+                        {% for option in filter.kapazitaet.options %}
10
+                            <option value="{{ option }}"{% if filter.kapazitaet.selected is defined and filter.kapazitaet.selected == option %} selected{% endif %}>{{ option }}</option>
11
+                        {% endfor %}
12
+                    </select>
32 13
                 </div>
33
-            </form>
34
-        {% endif %}
14
+                <div class="col-md-3 sorte">
15
+                    <select name="filter_sorte">
16
+                        <option value="">-</option>
17
+                        {% for key, option in filter.sorte.options %}
18
+                            <option value="{{ key }}"{% if filter.sorte.selected is defined and filter.sorte.selected == key %} selected{% endif %}>{{ option }}</option>
19
+                        {% endfor %}
20
+                    </select>
21
+                </div>
22
+                <div class="col-md-3 leseart">
23
+                    <select name="filter_leseart">
24
+                        <option value="">-</option>
25
+                        {% for key, option in filter.leseart.options %}
26
+                            <option value="{{ key }}"{% if filter.leseart.selected is defined and filter.leseart.selected == key %} selected{% endif %}>{{ option }}</option>
27
+                        {% endfor %}
28
+                    </select>
29
+                </div>
30
+                <div class="col submit"><button class="u-block w-100p">Filter übernehmen</button></div>
31
+            </div>
32
+        </form>
35 33
     {% endblock %}
36 34
 
37 35
     {% block content %}
... ...
@@ -20,6 +20,7 @@ use Contao\CoreBundle\ServiceAnnotation\FrontendModule;
20 20
 use Contao\Date;
21 21
 use Contao\FrontendUser;
22 22
 use Contao\ModuleModel;
23
+use Contao\PageModel;
23 24
 use Contao\StringUtil;
24 25
 use Contao\System;
25 26
 use Contao\Template;
... ...
@@ -47,6 +48,7 @@ class WeinanlieferungSlotsListModuleController extends AbstractFrontendModuleCon
47 48
 
48 49
     protected function getResponse(Template $template, ModuleModel $model, Request $request): ?Response
49 50
     {
51
+        global $objPage;
50 52
         $standortIds = StringUtil::deserialize($model->vr_wa_standortId);
51 53
         $arrData = $template->getData();
52 54
         $arrOptions = [];
... ...
@@ -119,6 +121,12 @@ class WeinanlieferungSlotsListModuleController extends AbstractFrontendModuleCon
119 121
             }
120 122
         }
121 123
 
124
+        // Add page URL
125
+        if ($objPage instanceof PageModel)
126
+        {
127
+            $arrData['pageUrl'] = $objPage->getFrontendUrl();
128
+        }
129
+
122 130
         $template->setData($arrData);
123 131
 
124 132
         // Handle ajax