Browse code

Introduce optional expanded booking view

Benjamin Roth authored on04/09/2025 23:43:39
Showing4 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,28 @@
1
+<?php
2
+
3
+/**
4
+ * This file is part of contao-weinanlieferung-bundle.
5
+ *
6
+ * (c) vonRotenberg
7
+ *
8
+ * @license commercial
9
+ */
10
+
11
+use Contao\CoreBundle\DataContainer\PaletteManipulator;
12
+
13
+// Extend the login palette
14
+PaletteManipulator::create()
15
+    ->addLegend('luumicore_legend', 'name_legend', PaletteManipulator::POSITION_AFTER)
16
+    ->addField('wa_expanded_bookings', 'luumicore_legend', PaletteManipulator::POSITION_APPEND)
17
+    ->applyToPalette('default', 'tl_user')
18
+    ->applyToPalette('login', 'tl_user')
19
+;
20
+
21
+// Add fields to tl_user
22
+$GLOBALS['TL_DCA']['tl_user']['fields']['wa_expanded_bookings'] = array
23
+(
24
+    'exclude'                 => true,
25
+    'inputType'               => 'checkbox',
26
+    'eval'                    => array('tl_class'=>'w50'),
27
+    'sql'                     => "char(1) NOT NULL default ''"
28
+);
0 29
new file mode 100644
... ...
@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * This file is part of contao-weinanlieferung-bundle.
5
+ *
6
+ * (c) vonRotenberg
7
+ *
8
+ * @license commercial
9
+ */
10
+
11
+// Legends
12
+$GLOBALS['TL_LANG']['tl_user']['luumicore_legend'] = 'luumiCORE-Einstellungen';
13
+
14
+// Fields
15
+$GLOBALS['TL_LANG']['tl_user']['wa_expanded_bookings'] = ['Expandierte Buchungsansicht', 'Zeigt standardmäßig alle Buchungen in der expandierten Ansicht an.'];
... ...
@@ -70,7 +70,7 @@
70 70
                                     <div class="bookings u-row-striped">
71 71
                                         {% for booking in bookings.items %}
72 72
                                             <!-- Collapsed view (always visible) -->
73
-                                            <div class="row u-items-flex-start booking-row">
73
+                                            <div class="row u-items-flex-start booking-row{{ theme.expandedView ? ' expanded' : '' }}">
74 74
                                                 <div class="col-1">
75 75
                                                     <span class="arrow" style="display: inline-block; font-size: 16px;">▶</span>
76 76
                                                 </div>
... ...
@@ -340,6 +340,7 @@ class WeinanlieferungBookingsController extends AbstractController
340 340
             'edit' => $security->isGranted(WeinanlieferungPermissions::USER_CAN_EDIT_RESERVATIONS),
341 341
             'delete' => $security->isGranted(WeinanlieferungPermissions::USER_CAN_DELETE_RESERVATIONS),
342 342
         ];
343
+        $arrData['theme']['expandedView'] = (bool) BackendUser::getInstance()->wa_expanded_bookings;
343 344
 
344 345
         return new Response(
345 346
             $this->twig->render(