@extends('layouts.admin') @section('title', 'Notificaciones | Liud Panel') @section('page_title', 'Notificaciones internas') @section('page_actions') @can('admin.notificaciones.crear') @endcan @endsection @push('styles') @endpush @section('content') @php $nivelNotificacion = function ($priority, $type = null) { $priority = strtolower((string) $priority); $type = strtolower((string) $type); if (in_array($priority, ['alto', 'alta'], true) || in_array($type, ['danger', 'error'], true)) { return ['key' => 'alto', 'label' => 'Alto', 'class' => 'text-bg-danger']; } if (in_array($priority, ['alerta', 'media'], true) || $type === 'warning') { return ['key' => 'alerta', 'label' => 'Alerta', 'class' => 'text-bg-warning']; } return ['key' => 'normal', 'label' => 'Normal', 'class' => 'text-bg-info']; }; @endphp
Pendientes
{{ $pendientes }}
No archivadas
{{ $total }}
@csrf @method('PATCH')
@if($q || $estado !== 'pendientes' || $prioridad) @endif
@forelse($notificaciones as $notificacion) @php $leida = $notificacion->isReadBy(auth()->user()); $nivel = $nivelNotificacion($notificacion->priority, $notificacion->type); $destino = $notificacion->user ? 'Usuario: ' . $notificacion->user->name : ($notificacion->role_name ? 'Rol: ' . $notificacion->role_name : 'Todos los usuarios'); @endphp
{{ $notificacion->title }}
{{ $nivel['label'] }}

{{ $notificacion->body ?: 'Sin mensaje adicional.' }}

{{ $notificacion->created_at?->format('d/m/Y H:i') }} {{ $notificacion->creator?->name ?? 'Sistema' }} {{ $destino }}
@if($leida)
@csrf @method('PATCH')
@else
@csrf @method('PATCH')
@endif
@csrf @method('PATCH')
@can('admin.notificaciones.eliminar')
@csrf @method('DELETE')
@endcan
@empty
No hay notificaciones

No se encontraron notificaciones con esos filtros.

@endforelse
{{ $notificaciones->links('pagination::bootstrap-5') }}
{{-- Modal único para ver cualquier notificación completa. --}} {{-- Confirmación propia: reemplaza el alert() / confirm() del navegador. --}} @can('admin.notificaciones.crear') @endcan @endsection @push('scripts') @endpush