Browse code

Attributes WIP

Benjamin Roth authored on06/08/2025 14:00:27
Showing2 changed files
... ...
@@ -69,84 +69,114 @@
69 69
                                     </h3>
70 70
                                     <div class="bookings u-row-striped">
71 71
                                         {% for booking in bookings.items %}
72
-                                            <div class="row u-items-flex-start">
72
+                                            <!-- Collapsed view (always visible) -->
73
+                                            <div class="row u-items-flex-start booking-row">
74
+                                                <div class="col-1">
75
+                                                    <span class="arrow" style="display: inline-block; font-size: 16px;">▶</span>
76
+                                                </div>
73 77
                                                 <div class="col-2 time icon-uhr-outline align">
74 78
                                                     <div class="t-label">Uhrzeit</div>
75 79
                                                     {{ booking.slot.time|date('H:i') }}
76
-                                                    <div class="t-label">Standort</div>
77
-                                                    {{ booking.standort }}
78
-                                                </div>
79
-                                                <div class="col-2 behaelter icon-behaelter-outline">
80
-                                                    <div class="t-label">Gebuchte Bottichkapazität</div>
81
-                                                    {{ booking.behaelter }}
82
-                                                    <div class="t-label">Anlieferungseinheit</div>
83
-                                                    {{ booking.amount }} x {{ booking.unit }}
84 80
                                                 </div>
85 81
                                                 <div class="col-3 rebsorten icon-reben-outline">
86 82
                                                     <div class="t-label">Mitglied</div>
87 83
                                                     {% if booking.member is not null %}
88
-                                                        {% if booking.member.memberno is defined %}
89
-                                                            <div>{{ booking.member.memberno }}</div>{% endif %}
90 84
                                                         <div>{{ booking.member.firstname }} {{ booking.member.lastname }}</div>
91
-                                                        {% if booking.member.phone is defined %}
92
-                                                            <div>{{ booking.member.phone }}</div>{% endif %}
93
-                                                        {% if booking.member.email is defined %}
94
-                                                            <div>
95
-                                                            <a href="mailto:{{ booking.member.email }}">{{ booking.member.email }}</a>
96
-                                                            </div>{% endif %}
97 85
                                                     {% endif %}
98 86
                                                 </div>
99
-                                                <div class="col-3 annotation">
100
-                                                    <div class="t-label">Anmerkung des Anlieferers</div>
101
-                                                    {{ booking.annotation }}
102
-
103
-                                                    {% if booking.attributes is defined and booking.attributes|length > 0 %}
104
-                                                        <div class="t-label">Attribute</div>
105
-                                                        <div class="attributes">
106
-                                                            {% set groups = {} %}
107
-                                                            {% for attribute in booking.attributes %}
108
-                                                                {% set group = attribute.group|default('Sonstige') %}
109
-                                                                {% if groups[group] is not defined %}
110
-                                                                    {% set groups = groups|merge({(group): []}) %}
111
-                                                                {% endif %}
112
-                                                                {% set groups = groups|merge({
113
-                                                                    (group): groups[group]|merge([{
114
-                                                                        'title': attribute.title,
115
-                                                                        'value': attribute.value
116
-                                                                    }])
117
-                                                                }) %}
118
-                                                            {% endfor %}
119
-
120
-                                                            {% for group, attributes in groups %}
121
-                                                                <div class="attribute-group">
122
-                                                                    <div class="group-title">{{ group }}</div>
123
-                                                                    {% for attribute in attributes %}
124
-                                                                        <div class="attribute-item">
125
-                                                                            {% if attribute.value %}
126
-                                                                                <strong>{{ attribute.title }}:</strong> {{ attribute.value }}
127
-                                                                            {% else %}
128
-                                                                                {{ attribute.title }}
129
-                                                                            {% endif %}
130
-                                                                        </div>
131
-                                                                    {% endfor %}
132
-                                                                </div>
133
-                                                            {% endfor %}
134
-                                                        </div>
135
-                                                    {% endif %}
87
+                                                <div class="col-2 behaelter icon-behaelter-outline">
88
+                                                    <div class="t-label">Geb. Bottichkapazität</div>
89
+                                                    {{ booking.behaelter }}
90
+                                                </div>
91
+                                                <div class="col-2 behaelter icon-behaelter-outline">
92
+                                                    <div class="t-label">Anlieferungseinheit</div>
93
+                                                    {{ booking.amount }} x {{ booking.unit }}
136 94
                                                 </div>
137 95
                                                 <div class="col u-text-right action">
138 96
                                                     <a
139 97
                                                         href="/contao?do=weinanlieferung&table=tl_vr_wa_reservation&act=edit&id={{ booking.id }}&rt={{ request_token }}&ref={{ ref }}"
140
-                                                        {#                        onclick="Backend.openModalIframe({'title':'Quellelement ID {{ booking.id }} bearbeiten','url':this.href});return false" #}
141 98
                                                         title="Element ID {{ booking.id }} bearbeiten"
99
+                                                        onclick="event.stopPropagation()"
142 100
                                                     ><img src="/system/themes/flexible/icons/edit.svg" width="16" height="16" alt="Element ID {{ booking.id }} bearbeiten"></a>
143 101
                                                     <a
144 102
                                                         href="/contao?do=weinanlieferung&table=tl_vr_wa_reservation&act=delete&id={{ booking.id }}&rt={{ request_token }}"
145
-                                                        onclick="if(!confirm('Soll das Element ID {{ booking.id }} wirklich gelöscht werden?'))return false;Backend.getScrollOffset()"
103
+                                                        onclick="event.stopPropagation(); if(!confirm('Soll das Element ID {{ booking.id }} wirklich gelöscht werden?'))return false;Backend.getScrollOffset()"
146 104
                                                         title="Element ID {{ booking.id }} löschen"
147 105
                                                     ><img src="/system/themes/flexible/icons/delete.svg" width="16" height="16" alt="Element ID {{ booking.id }} löschen"></a>
148 106
                                                 </div>
149 107
                                             </div>
108
+
109
+                                            <!-- Expanded view (hidden by default) -->
110
+                                            <div class="booking-details">
111
+                                                <div class="row u-items-flex-start">
112
+                                                    <div class="col-1">
113
+                                                        <!-- Empty space for alignment -->
114
+                                                    </div>
115
+                                                    <div class="col-2">
116
+                                                        <div class="t-label">Standort</div>
117
+                                                        {{ booking.standort }}
118
+                                                    </div>
119
+                                                    <div class="col-3">
120
+                                                        <!-- Member details -->
121
+                                                        <div class="t-label">Mitglied Details</div>
122
+                                                        {% if booking.member is not null %}
123
+                                                            {% if booking.member.memberno is defined %}
124
+                                                                <div>{{ booking.member.memberno }}</div>
125
+                                                            {% endif %}
126
+                                                            {% if booking.member.phone is defined %}
127
+                                                                <div>{{ booking.member.phone }}</div>
128
+                                                            {% endif %}
129
+                                                            {% if booking.member.email is defined %}
130
+                                                                <div><a href="mailto:{{ booking.member.email }}">{{ booking.member.email }}</a></div>
131
+                                                            {% endif %}
132
+                                                        {% endif %}
133
+                                                    </div>
134
+                                                    {% if booking.attributes is defined and booking.attributes|length > 0 %}
135
+                                                        <div class="col-6">
136
+                                                            <div class="t-label">Attribute</div>
137
+                                                            <div class="attributes">
138
+                                                                {% set groups = {} %}
139
+                                                                {% for attribute in booking.attributes %}
140
+                                                                    {% set group = attribute.group|default('Sonstige') %}
141
+                                                                    {% if groups[group] is not defined %}
142
+                                                                        {% set groups = groups|merge({(group): []}) %}
143
+                                                                    {% endif %}
144
+                                                                    {% set groups = groups|merge({
145
+                                                                        (group): groups[group]|merge([{
146
+                                                                            'title': attribute.title,
147
+                                                                            'value': attribute.value
148
+                                                                        }])
149
+                                                                    }) %}
150
+                                                                {% endfor %}
151
+
152
+                                                                {% for group, attributes in groups %}
153
+                                                                    <div class="attribute-group">
154
+                                                                        <div class="group-title">{{ group }}</div>
155
+                                                                        {% for attribute in attributes %}
156
+                                                                            <div class="attribute-item">
157
+                                                                                {% if attribute.value %}
158
+                                                                                    <strong>{{ attribute.title }}:</strong> {{ attribute.value }}
159
+                                                                                {% else %}
160
+                                                                                    {{ attribute.title }}
161
+                                                                                {% endif %}
162
+                                                                            </div>
163
+                                                                        {% endfor %}
164
+                                                                    </div>
165
+                                                                {% endfor %}
166
+                                                            </div>
167
+                                                        </div>
168
+                                                    {% endif %}
169
+                                                    {% if booking.annotation is not empty %}
170
+                                                    <div class="col-1">
171
+                                                        <!-- Empty space for alignment -->
172
+                                                    </div>
173
+                                                    <div class="col-11">
174
+                                                        <div class="t-label">Anmerkung des Anlieferers</div>
175
+                                                        {{ booking.annotation }}
176
+                                                    </div>
177
+                                                    {% endif %}
178
+                                                </div>
179
+                                            </div>
150 180
                                         {% endfor %}
151 181
                                     </div>
152 182
                                 {% endfor %}
... ...
@@ -160,4 +190,14 @@
160 190
 
161 191
         </div>
162 192
     </div>
193
+
194
+    <script>
195
+        document.addEventListener('DOMContentLoaded', function() {
196
+            document.querySelectorAll('.booking-row').forEach(function(row) {
197
+                row.addEventListener('click', function() {
198
+                    this.classList.toggle('expanded');
199
+                });
200
+            });
201
+        });
202
+    </script>
163 203
 {% endblock %}
... ...
@@ -45,6 +45,22 @@
45 45
   margin-top: 0.2rem;
46 46
 }
47 47
 
48
+.bookings .booking-row {
49
+  cursor: pointer;
50
+}
51
+.bookings .booking-row .arrow {
52
+  transition: transform 0.3s ease;
53
+}
54
+.bookings .booking-row.expanded .arrow {
55
+  transform: rotate(90deg);
56
+}
57
+.bookings .booking-details {
58
+  display: none;
59
+}
60
+.bookings .booking-row.expanded + .booking-details {
61
+  display: block;
62
+}
63
+
48 64
 .u-row-striped > *:nth-child(even) {
49 65
   background-color: #fff6ef;
50 66
 }
... ...
@@ -107,6 +123,7 @@
107 123
   width: 100%;
108 124
   margin-left: 0;
109 125
   padding: 0 0.5rem;
126
+  box-sizing: border-box;
110 127
 }
111 128
 
112 129
 @media screen and (min-width: 768px) {