Browse code

Implement BE reservation list filter for approval status

Benjamin Roth authored on11/09/2024 10:25:09
Showing2 changed files
... ...
@@ -38,6 +38,12 @@
38 38
                             <option value="{{ value }}"{{ filter.standort.selected is defined and filter.standort.selected == value ? ' selected' : '' }}>{{ label }}</option>
39 39
                         {% endfor %}
40 40
                     </select>
41
+                    <select name="tl_status" id="tl_status" class="tl_select tl_chosen{% if filter.status.selected is defined %} active{% endif %}">
42
+                        <option value=""{{ filter.status.selected is not defined or not filter.status.selected ? ' selected' : '' }}>Status</option>
43
+                        <option value="pending"{{ filter.status.selected is defined and filter.status.selected == 'pending' ? ' selected' : '' }}>{{ ('MSC.wa_approval_status.pending')|trans([], 'contao_default') }}</option>
44
+                        <option value="approved"{{ filter.status.selected is defined and filter.status.selected == 'approved' ? ' selected' : '' }}>{{ ('MSC.wa_approval_status.approved')|trans([], 'contao_default') }}</option>
45
+                        <option value="canceled"{{ filter.status.selected is defined and filter.status.selected == 'canceled' ? ' selected' : '' }}>{{ ('MSC.wa_approval_status.canceled')|trans([], 'contao_default') }}</option>
46
+                    </select>
41 47
                 </div>
42 48
             </div>
43 49
         </div>
... ...
@@ -172,6 +172,24 @@ class WeinanlieferungBookingsController extends AbstractController
172 172
             {
173 173
                 $arrColumns[] = "pid IN (".implode(',',$arrSlots).")";
174 174
             }
175
+            if (!empty($session['tl_vr_wa_reservation']['tl_status']))
176
+            {
177
+                $arrData['filter']['status']['selected'] = $session['tl_vr_wa_reservation']['tl_status'];
178
+                switch ($session['tl_vr_wa_reservation']['tl_status'])
179
+                {
180
+                    case 'pending':
181
+                        $arrColumns[] = "approved = ''";
182
+                        break;
183
+
184
+                    case 'approved':
185
+                        $arrColumns[] = "approved = '1'";
186
+                        break;
187
+
188
+                    case 'canceled':
189
+                        $arrColumns[] = "approved = '0'";
190
+                        break;
191
+                }
192
+            }
175 193
             if (!$arrColumns)
176 194
             {
177 195
                 $bookings = WeinanlieferungReservationModel::findAllFuture(['order' => "(SELECT tl_vr_wa_slot.time FROM tl_vr_wa_slot WHERE tl_vr_wa_slot.id=tl_vr_wa_reservation.pid) ASC"]);