@extends('layouts.app') @section('title', 'Notificaciones — Fermenty') @push('head') @endpush @section('content')
Notificaciones

Recordatorios y alertas de tus fermentos

@php $unreadCount = $notifications->flatten()->where('read_at', null)->count(); @endphp @if($unreadCount > 0)
@csrf
@endif
@if($notifications->isEmpty())
🔔
Sin notificaciones
Cuando tengas lotes activos recibirás recordatorios aquí
Crear un lote
@else @foreach($notifications as $batchId => $batchNotifs) @php $batch = $batchNotifs->first()->batch; $unread = $batchNotifs->where('read_at', null)->count(); $collapseId = 'batch-notif-' . ($batchId ?: 'general'); // Collapsed by default; open only if it's the single group, or the one // targeted by ?lote=. Keeps the screen clear; click to expand the rest. $isOpen = $notifications->count() === 1 || (request('lote') && (string) $batchId === (string) request('lote')); @endphp
@foreach($batchNotifs->sortBy('scheduled_at') as $notif) @php $isPast = $notif->scheduled_at->isPast(); @endphp
@if($notif->type === 'alert') ⚠️ @elseif($notif->type === 'suggestion') 💡 @elseif($notif->type === 'community') 💬 @else 🔔 @endif
{{ $notif->title }}
@php $chIcon = ['email' => '✉️', 'push' => '📱', 'both' => '✉️📱'][$notif->channel] ?? '🔔'; $chLabel = ['email' => 'Email', 'push' => 'Push', 'both' => 'Email + Push'][$notif->channel] ?? $notif->channel; @endphp {{ $chIcon }} {{ $notif->scheduled_at->diffForHumans() }} @if(!$notif->read_at)
@csrf
@endif
{{ $notif->message }}
@if($notif->link) → Ver publicación @endif
@endforeach @if($batch) @endif
@endforeach @endif @endsection @if(request('lote')) @push('scripts') @endpush @endif