Browse code

Always show current slot in reservation regardless whether it is in the past.

Benjamin Roth authored on01/09/2025 14:24:05
Showing1 changed files
... ...
@@ -108,12 +108,30 @@ class WeinanlieferungReservationContainerListener
108 108
      */
109 109
     public function onPidOptionsCallback(DataContainer $dc)
110 110
     {
111
+        $arrData = [];
112
+
113
+        if (($CurrentSlot = WeinanlieferungSlotsModel::findByPk($dc->activeRecord->pid)) !== null)
114
+        {
115
+            $arrSorten = [];
116
+            $intAvailableBehaelter = $CurrentSlot->getAvailableBehaelter();
117
+
118
+            $Standort = $CurrentSlot->getRelated('pid');
119
+
120
+            $Sorten = StringUtil::deserialize($CurrentSlot->sorten,true);
121
+            foreach($Sorten as $sorte)
122
+            {
123
+                $objSorte = WeinanlieferungRebsorteModel::findByPk($sorte['sorte']);
124
+                $objLeseart = WeinanlieferungLeseartModel::findByPk($sorte['leseart']);
125
+                $arrSorten[] = ($objSorte !== null  ? $objSorte->title : '') . ' ' . ($objLeseart !== null  ? $objLeseart->title : '');
126
+            }
127
+            $arrData[$CurrentSlot->id] = Date::parse(Date::getNumericDatimFormat(),$CurrentSlot->time) . ' - ' . ($Standort !== null  ? $Standort->title : $CurrentSlot->pid) . ' - (' . implode(', ',$arrSorten) . ') [Verfügbare Behälter: ' . $intAvailableBehaelter . '/' . $CurrentSlot->behaelter . ']';
128
+        }
129
+
111 130
         if (($Slots = WeinanlieferungSlotsModel::findAllFuturePublished()) === null)
112 131
         {
113
-            return [];
132
+            return $arrData;
114 133
         }
115 134
 
116
-        $arrData = [];
117 135
         foreach ($Slots as $slot)
118 136
         {
119 137
             $arrSorten = [];