@extends('layouts.app') @section('content')

Dashboard

Vessels

{{ \App\Models\Vessel::count() }}

View All Vessels
Certificates

{{ \App\Models\VesselCertificate::count() }}

Users

{{ \App\Models\User::count() }}

@if(auth()->user()->is_admin) Manage Users @else

Only admins can manage users.

@endif
Expiring Certificates
@php $warningSettings = \App\Models\WarningSettings::first(); $warningDays = $warningSettings ? $warningSettings->warning_days : 30; $dangerDays = $warningSettings ? $warningSettings->danger_days : 7; $expiringCertificates = \App\Models\VesselCertificate::whereNotNull('expiry_date') ->whereDate('expiry_date', '>=', now()) ->whereDate('expiry_date', '<=', now()->addDays($warningDays)) ->with(['vessel', 'certificate']) ->orderBy('expiry_date') ->get(); @endphp @if($expiringCertificates->count() > 0)
@foreach($expiringCertificates as $cert) @php $daysLeft = (int)$cert->expiry_date->diffInDays(now()); $isDanger = $cert->expiry_date < now()->addDays($dangerDays); @endphp @endforeach
Vessel Certificate Expiry Date Status Action
{{ $cert->vessel->name }} {{ $cert->certificate->name }} {{ $cert->expiry_date->format('Y-m-d') }} @if($isDanger) Critical - {{ $daysLeft }} days @else Warning - {{ $daysLeft }} days @endif
@else

No certificates expiring in the next {{ $warningDays }} days.

@endif
Expired Certificates
@php $expiredCertificates = \App\Models\VesselCertificate::whereNotNull('expiry_date') ->whereDate('expiry_date', '<', now()) ->with(['vessel', 'certificate']) ->orderBy('expiry_date', 'desc') ->get(); @endphp @if($expiredCertificates->count() > 0)
@foreach($expiredCertificates as $cert) @php $daysOverdue = (int)now()->diffInDays($cert->expiry_date); @endphp @endforeach
Vessel Certificate Expiry Date Overdue Action
{{ $cert->vessel->name }} {{ $cert->certificate->name }} {{ $cert->expiry_date->format('Y-m-d') }} {{ $daysOverdue }} days overdue
@else

No expired certificates.

@endif
@endsection