Browse code

Update

Benjamin Roth authored on17/08/2023 13:21:23
Showing2 changed files
... ...
@@ -129,9 +129,10 @@ $GLOBALS['TL_DCA']['tl_vr_wa_slot'] = array
129 129
         'time'        => array
130 130
         (
131 131
             'exclude'   => true,
132
+            'filter'    => true,
132 133
             'default'   => time(),
133 134
             'sorting'   => true,
134
-            'flag'      => DataContainer::SORT_MONTH_ASC,
135
+            'flag'      => DataContainer::SORT_DAY_ASC,
135 136
             'inputType' => 'text',
136 137
             'eval'      => array('rgxp' => 'time', 'mandatory' => true, 'tl_class' => 'w50'),
137 138
             'sql'       => "int(10) NULL"
... ...
@@ -15,7 +15,11 @@ namespace vonRotenberg\WeinanlieferungBundle\EventListener\DataContainer;
15 15
 use Contao\CoreBundle\ServiceAnnotation\Callback;
16 16
 use Contao\DataContainer;
17 17
 use Contao\Date;
18
+use Contao\StringUtil;
18 19
 use Doctrine\DBAL\Connection;
20
+use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungLeseartModel;
21
+use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungRebsorteModel;
22
+use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungSlotsModel;
19 23
 
20 24
 class WeinanlieferungSlotContainerListener
21 25
 {
... ...
@@ -33,7 +37,27 @@ class WeinanlieferungSlotContainerListener
33 37
      */
34 38
     public function onChildRecordCallback(array $row)
35 39
     {
36
-        return sprintf('<div class="tl_content_left">%s %s</div>',Date::parse(Date::getNumericDateFormat(),$row['date']), Date::parse(Date::getNumericTimeFormat(),$row['time']));
40
+        $Slot = WeinanlieferungSlotsModel::findByPk($row['id']);
41
+
42
+        $arrSorten = [];
43
+
44
+        $Sorten = StringUtil::deserialize($Slot->sorten,true);
45
+        foreach($Sorten as $sorte)
46
+        {
47
+            $objSorte = WeinanlieferungRebsorteModel::findByPk($sorte['sorte']);
48
+            $objLeseart = WeinanlieferungLeseartModel::findByPk($sorte['leseart']);
49
+            $arrSorten[] = ($objSorte !== null  ? $objSorte->title : '') . ' ' . ($objLeseart !== null  ? $objLeseart->title : '');
50
+        }
51
+
52
+        return sprintf('<div class="tl_content_left"><div class="row u-items-center">
53
+            <div class="col-2 text-md">%s %s</div>
54
+            <div class="col-3">
55
+              <div class="t-label">Behälterkapazität</div>%s
56
+            </div>
57
+            <div class="col-3">
58
+              <div class="t-label">Sorten</div>%s
59
+            </div>
60
+        </div></div>',Date::parse(Date::getNumericDateFormat(),$row['date']), Date::parse(Date::getNumericTimeFormat(),$row['time']),$Slot->behaelter,implode(', ',$arrSorten));
37 61
     }
38 62
 
39 63
     /**