@php
$expiringClientDocs = \App\Models\ClientDocument::whereNotNull('expiration_date')
->where('expiration_date', '<=', now()->addDays(30))
->where('expiration_date', '>', now())
->where('is_active', true)
->with('client')
->get();
$expiringSalesmanDocs = \App\Models\SalesmanDocument::whereNotNull('expiration_date')
->where('expiration_date', '<=', now()->addDays(30))
->where('expiration_date', '>', now())
->where('is_active', true)
->with('salesman')
->get();
@endphp
{{ $expiringClientDocs->count() + $expiringSalesmanDocs->count() }} documentos
@if($expiringClientDocs->count() > 0 || $expiringSalesmanDocs->count() > 0)
@foreach($expiringClientDocs->take(5) as $doc)
{{ $doc->document_name }}
{{ $doc->client->business_name }}
{{ now()->diffInDays($doc->expiration_date, false) }} días
@endforeach
@foreach($expiringSalesmanDocs->take(5) as $doc)
{{ $doc->document_name }}
{{ $doc->salesman->full_name }}
{{ now()->diffInDays($doc->expiration_date, false) }} días
@endforeach
@else
No hay documentos próximos a vencer
@endif