Sfoglia il codice sorgente

busqueda y adjunto de ICON para las notificaciones byUser

EmilianoOrtiz 1 giorno fa
parent
commit
063ed583e1

+ 17 - 0
sistema-mantenimiento-back/app/Http/Controllers/NotificationsController.php

@@ -219,6 +219,7 @@ class NotificationsController extends Controller{
             'NOTI_IDOT AS ID_ORDEN',
             'NOTI_TIOR AS TIPO_ORDEN',
             'NOTI_COLO AS COLOR',
+            'NOTI_ACCI AS ACCIONES',
             'NOTI_AUDI AS AUDIENCIA',
             'NOTI_ALCA AS ALCANCE',
             'NOTI_USRE AS USRREG',
@@ -256,6 +257,22 @@ class NotificationsController extends Controller{
 
             $nameReg = $this->functionsController->joinName($usrReg->USUA_NOMB, $usrReg->USUA_APPA, $usrReg->USUA_APMA);
             $notification->USRREG = $nameReg . " (" . $notification->USRREG . ")";
+            
+            // Extract ICON_ID from actions if exists
+            $notification->ICON = null;
+            if (!empty($notification->ACCIONES)) {
+                $actions = json_decode($notification->ACCIONES, true);
+                if (is_array($actions)) {
+                    foreach ($actions as $action) {
+                        if (isset($action['ICON_ID'])) {
+                            $notification->ICON = $action['ICON_ID'];
+                            break;
+                        }
+                    }
+                }
+            }
+            unset($notification->ACCIONES);
+            
             $notifications[$key] = $notification;
         }