@extends('layouts.app') @section('content')
| ID | Name | Certificates | Warnings | Created | Actions |
|---|---|---|---|---|---|
| {{ $vessel->id }} | {{ $vessel->name }} | @php $filledCertificates = $vessel->vesselCertificates->filter(function($cert) { return $cert->issued_date || $cert->expiry_date || $cert->attachment_path; })->count(); @endphp {{ $filledCertificates }} | @php $warningSettings = \App\Models\WarningSettings::first(); $warningDays = $warningSettings ? $warningSettings->warning_days : 30; $dangerDays = $warningSettings ? $warningSettings->danger_days : 7; $expiring = 0; $expired = 0; $danger = 0; foreach($vessel->vesselCertificates as $cert) { if($cert->expiry_date) { if($cert->expiry_date < now()) { $expired++; } elseif($cert->expiry_date < now()->addDays($dangerDays)) { $danger++; } elseif($cert->expiry_date < now()->addDays($warningDays)) { $expiring++; } } } @endphp @if($expired > 0) {{ $expired }} Expired @endif @if($danger > 0) {{ $danger }} Critical @endif @if($expiring > 0) {{ $expiring }} Warning @endif | {{ $vessel->created_at->format('Y-m-d') }} | |
| No vessels found. | |||||