Browse code

Update

Benjamin Roth authored on31/08/2023 14:50:19
Showing2 changed files
... ...
@@ -3,15 +3,15 @@
3 3
     {% block filter %}
4 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 5
             <div class="row">
6
-                <div class="col-md-3 kapazitaet">
6
+                <div class="col-md-2 kapazitaet">
7 7
                     <select name="filter_kapazitaet">
8
-                        <option value="">-- Behälterkapazität --</option>
8
+                        <option value="">-- Kapazität --</option>
9 9
                         {% for option in filter.kapazitaet.options %}
10 10
                             <option value="{{ option }}"{% if filter.kapazitaet.selected is defined and filter.kapazitaet.selected == option %} selected{% endif %}>{{ option }}</option>
11 11
                         {% endfor %}
12 12
                     </select>
13 13
                 </div>
14
-                <div class="col-md-3 standort">
14
+                <div class="col-md-2 standort">
15 15
                     <select name="filter_standort">
16 16
                         <option value="">-- Standort --</option>
17 17
                         {% for key, option in filter.standort.options %}
... ...
@@ -19,6 +19,14 @@
19 19
                         {% endfor %}
20 20
                     </select>
21 21
                 </div>
22
+                <div class="col-md-2 ernteart">
23
+                    <select name="filter_ernteart">
24
+                        <option value="">-- Ernteart --</option>
25
+                        {% for key, option in filter.ernteart.options %}
26
+                            <option value="{{ key }}"{% if filter.ernteart.selected is defined and filter.ernteart.selected == key %} selected{% endif %}>{{ option }}</option>
27
+                        {% endfor %}
28
+                    </select>
29
+                </div>
22 30
                 <div class="col-md-3 sorte">
23 31
                     <select name="filter_sorte">
24 32
                         <option value="">-- Sorte --</option>
... ...
@@ -50,6 +50,7 @@ class WeinanlieferungSlotsListModuleController extends AbstractFrontendModuleCon
50 50
     protected function getResponse(Template $template, ModuleModel $model, Request $request): ?Response
51 51
     {
52 52
         global $objPage;
53
+        Controller::loadDataContainer('tl_vr_wa_slot');
53 54
         $GLOBALS['TL_CSS']['vr_wa'] = 'bundles/vonrotenbergweinanlieferung/css/frontend.scss|static';
54 55
         $standortIds = StringUtil::deserialize($model->vr_wa_standortId);
55 56
         $arrData = $template->getData();
... ...
@@ -68,6 +69,12 @@ class WeinanlieferungSlotsListModuleController extends AbstractFrontendModuleCon
68 69
             $arrOptions['column'][] = 'pid = ?';
69 70
             $arrOptions['value'][] = $_GET['filter_standort'];
70 71
         }
72
+        if (!empty($_GET['filter_ernteart']))
73
+        {
74
+            $arrData['filter']['ernteart']['selected'] = $_GET['filter_ernteart'];
75
+            $arrOptions['column'][] = 'FIND_IN_SET (?,ernteart)';
76
+            $arrOptions['value'][] = $_GET['filter_ernteart'];
77
+        }
71 78
         if (!empty($_GET['filter_sorte']) && !empty($_GET['filter_leseart']))
72 79
         {
73 80
             $arrData['filter']['sorte']['selected'] = $_GET['filter_sorte'];
... ...
@@ -93,6 +100,14 @@ class WeinanlieferungSlotsListModuleController extends AbstractFrontendModuleCon
93 100
             $arrData['filter']['standort']['options'] = array_combine($Standorte->fetchEach('id'),$Standorte->fetchEach('title'));
94 101
         }
95 102
 
103
+        if (isset($GLOBALS['TL_DCA']['tl_vr_wa_slot']['fields']['ernteart']['options']))
104
+        {
105
+            foreach ($GLOBALS['TL_DCA']['tl_vr_wa_slot']['fields']['ernteart']['options'] as $ernteart)
106
+            {
107
+                $arrData['filter']['ernteart']['options'][$ernteart] = $GLOBALS['TL_LANG']['REF']['wa_ernteart'][$ernteart] ?? $ernteart;
108
+            }
109
+        }
110
+
96 111
         if (($Sorten = WeinanlieferungRebsorteModel::findAll(['order'=>'title ASC'])) !== null)
97 112
         {
98 113
             $arrData['filter']['sorte']['options'] = array_combine($Sorten->fetchEach('id'),$Sorten->fetchEach('title'));