Browse code

Add backend translations and select widget for approval

Benjamin Roth authored on05/09/2024 11:27:46
Showing5 changed files
... ...
@@ -188,8 +188,10 @@ $GLOBALS['TL_DCA']['tl_vr_wa_reservation'] = array
188 188
         'approved' => array
189 189
         (
190 190
             'exclude'                 => true,
191
-            'inputType'               => 'checkbox',
192
-            'eval'                    => array('tl_class'=>'w50 m12'),
191
+            'inputType'               => 'select',
192
+            'options'                 => ['1','0'],
193
+            'reference'               => $GLOBALS['TL_LANG']['REF']['wa_approval'],
194
+            'eval'                    => array('tl_class'=>'w50 m12', 'includeBlankOption' => true, 'blankOptionLabel' => $GLOBALS['TL_LANG']['MSC']['wa_approval_pending']),
193 195
             'sql'                     => "char(1) NOT NULL default '1'"
194 196
         ),
195 197
         'approved_on' => array
... ...
@@ -11,8 +11,14 @@
11 11
 $GLOBALS['TL_LANG']['MSC']['wa_sorte'] = 'Rebsorte';
12 12
 $GLOBALS['TL_LANG']['MSC']['wa_leseart'] = 'Leseart';
13 13
 $GLOBALS['TL_LANG']['MSC']['wa_approval_needed'] = 'erfordert Freigabe';
14
+$GLOBALS['TL_LANG']['MSC']['wa_approval_pending'] = 'Freigabe ausstehend';
14 15
 
15 16
 $GLOBALS['TL_LANG']['REF']['wa_ernteart'] = [
16 17
     'handlese' => 'Handlese',
17 18
     'vollernter' => 'Vollernter',
18 19
 ];
20
+
21
+$GLOBALS['TL_LANG']['REF']['wa_approval'] = [
22
+    '0' => 'abgelehnt',
23
+    '1' => 'angenommen',
24
+];
... ...
@@ -10,8 +10,15 @@
10 10
 
11 11
 $GLOBALS['TL_LANG']['MSC']['wa_sorte'] = 'Grape variety';
12 12
 $GLOBALS['TL_LANG']['MSC']['wa_leseart'] = 'Harvest type';
13
+$GLOBALS['TL_LANG']['MSC']['wa_approval_needed'] = 'approval needed';
14
+$GLOBALS['TL_LANG']['MSC']['wa_approval_pending'] = 'approval pending';
13 15
 
14 16
 $GLOBALS['TL_LANG']['REF']['wa_ernteart'] = [
15 17
     'handlese' => 'Manual harvest',
16 18
     'vollernter' => 'Harvester',
17 19
 ];
20
+
21
+$GLOBALS['TL_LANG']['REF']['wa_approval'] = [
22
+    '0' => 'denied',
23
+    '1' => 'approved',
24
+];
... ...
@@ -72,7 +72,20 @@
72 72
                     <h4>Ihre Reservierungen</h4>
73 73
                     <ul class="no-bullets mx-0 reservations">
74 74
                         {% for reservation in reservations %}
75
-                            <li class="row u-items-center p-0">
75
+                            {% if reservation.approved == '1' %}
76
+                                {% set status = 'approved' %}
77
+                            {% elseif reservation.approved == '0' %}
78
+                                {% set status = 'canceled' %}
79
+                            {% else %}
80
+                                {% set status = 'pending' %}
81
+                            {% endif %}
82
+
83
+                            <li class="row u-items-center p-0 status status--{{ status }}">
84
+                                <div class="col-1">
85
+                                    <div class="u-flex u-items-center u-gap-1">
86
+                                        <i class="status-icon">Blah</i>
87
+                                    </div>
88
+                                </div>
76 89
                                 <div class="col-2">
77 90
                                     <div class="u-flex u-items-center u-gap-1">
78 91
                                         <i class="icon-behaelter-outline"></i>
... ...
@@ -91,6 +104,21 @@
91 104
                             </li>
92 105
                         {% endfor %}
93 106
                     </ul>
107
+                    <div class="u-flex u-items-center u-gap-2 px-1 text-sm">
108
+                        <div><strong>Legende:</strong></div>
109
+                        <div class="u-flex u-items-center u-gap-1">
110
+                            <i class="status-icon status--approved status--small"></i>
111
+                            angenommen
112
+                        </div>
113
+                        <div class="u-flex u-items-center u-gap-1">
114
+                            <i class="status-icon status--pending status--small"></i>
115
+                            Freigabe ausstehend
116
+                        </div>
117
+                        <div class="u-flex u-items-center u-gap-1">
118
+                            <i class="status-icon status--canceled status--small"></i>
119
+                            abgelehnt
120
+                        </div>
121
+                    </div>
94 122
                 </div>
95 123
             {% endif %}
96 124
 
... ...
@@ -211,3 +211,100 @@ ul {
211 211
 .ml-auto {
212 212
   margin-left: auto;
213 213
 }
214
+
215
+/** Status icons */
216
+
217
+.status {
218
+
219
+  .status-icon {
220
+    visibility: hidden;
221
+    position: relative;
222
+    width: 24px;
223
+    height: 24px;
224
+
225
+    &:after {
226
+      width: 24px;
227
+      height: 24px;
228
+      visibility: visible;
229
+      position: absolute;
230
+      top: 50%;
231
+      left: 50%;
232
+      margin: -12px 0 0 -12px;
233
+      content: '';
234
+      background-position: 50% 50%;
235
+      background-repeat: no-repeat;
236
+    }
237
+
238
+  }
239
+}
240
+.status-icon {
241
+  visibility: hidden;
242
+  position: relative;
243
+  display: inline-block;
244
+  width: 24px;
245
+  height: 24px;
246
+
247
+  &:after {
248
+    width: 24px;
249
+    height: 24px;
250
+    visibility: visible;
251
+    position: absolute;
252
+    top: 50%;
253
+    left: 50%;
254
+    margin: -12px 0 0 -12px;
255
+    content: '';
256
+    background-position: 50% 50%;
257
+    background-repeat: no-repeat;
258
+  }
259
+
260
+  &.status--small,
261
+  .status.status--small & {
262
+    &,
263
+    &:after {
264
+      width: 16px;
265
+      height: 16px;
266
+    }
267
+    &:after {
268
+      margin: -8px 0 0 -8px;
269
+    }
270
+  }
271
+}
272
+
273
+.status,
274
+.status-icon {
275
+  &.status--approved {
276
+    &:not(.status-icon):not(.status-no-rowcolor) {
277
+      background-color: #f3ffe2;
278
+    }
279
+    &:not(.status),
280
+    .status-icon {
281
+      &:after {
282
+        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='icon icon-tabler icon-tabler-thumb-up' width='100%25' height='100%25' viewBox='0 0 24 24' stroke-width='1.5' stroke='%2300b341' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M7 11v8a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-7a1 1 0 0 1 1 -1h3a4 4 0 0 0 4 -4v-1a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1 -2 2h-7a3 3 0 0 1 -3 -3' /%3E%3C/svg%3E");
283
+      }
284
+    }
285
+  }
286
+
287
+  &.status--pending {
288
+    &:not(.status-icon):not(.status-no-rowcolor) {
289
+      background-color: #fff6e4;
290
+    }
291
+    &:not(.status),
292
+    .status-icon {
293
+      &:after {
294
+        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='icon icon-tabler icon-tabler-hourglass-high' width='100%25' height='100%25' viewBox='0 0 24 24' stroke-width='1.5' stroke='%23ff9300' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M6.5 7h11' /%3E%3Cpath d='M6 20v-2a6 6 0 1 1 12 0v2a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1 -1z' /%3E%3Cpath d='M6 4v2a6 6 0 1 0 12 0v-2a1 1 0 0 0 -1 -1h-10a1 1 0 0 0 -1 1z' /%3E%3C/svg%3E");
295
+      }
296
+    }
297
+  }
298
+
299
+  &.status--canceled {
300
+    &:not(.status-icon):not(.status-no-rowcolor) {
301
+      background-color: #ffe7e7;
302
+    }
303
+    &:not(.status),
304
+    .status-icon {
305
+      &:after {
306
+        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='icon icon-tabler icon-tabler-thumb-down' width='100%25' height='100%25' viewBox='0 0 24 24' stroke-width='1.5' stroke='%23ff2825' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M7 13v-8a1 1 0 0 0 -1 -1h-2a1 1 0 0 0 -1 1v7a1 1 0 0 0 1 1h3a4 4 0 0 1 4 4v1a2 2 0 0 0 4 0v-5h3a2 2 0 0 0 2 -2l-1 -5a2 3 0 0 0 -2 -2h-7a3 3 0 0 0 -3 3' /%3E%3C/svg%3E");
307
+      }
308
+    }
309
+  }
310
+}