@extends('layouts.main') @section('container')

Vessel Fuel Refill Tracking

Monitor fuel consumption patterns

@foreach ($vesselData as $vesselId => $data) @php $refillCount = count($data['refills']); $lastRefill = $refillCount > 0 ? end($data['refills'])['date'] : null; $avgDaysBetween = null; $nextPredicted = null; $accuracyPercentage = 'Low'; if ($refillCount > 1) { $totalDays = 0; for ($i = 1; $i < $refillCount; $i++) { $totalDays += $data['refills'][$i]['date']->diffInDays($data['refills'][$i - 1]['date']); } $avgDaysBetween = round($totalDays / ($refillCount - 1)); if ($lastRefill) { $nextPredicted = $lastRefill->copy()->addDays($avgDaysBetween); if ($nextPredicted < now()) { $nextPredicted = now()->addDay(); } } } @endphp
{{ $data['name'] }}
{{ $data['fuel_type'] }}
Refills: {{ $refillCount }}
Total Volume: {{ number_format($data['total_volume']) }} L
@if ($avgDaysBetween)
Avg. Interval: {{ $avgDaysBetween }} days
@if ($nextPredicted)
Next Predicted: {{ $nextPredicted->format('M d') }}
{{ $accuracyPercentage }} confidence
@endif @endif
@endforeach
Fuel Refill Overview
@foreach ($vesselData as $vesselId => $data)

Consumption Pattern
Refill History
@foreach ($data['refills'] as $index => $refill)
{{ $refill['date']->format('M j, Y') }}
{{ number_format($refill['volume']) }} L

{{ $refill['location'] }}

@if ($index > 0)

{{ $refill['date']->diffInDays($data['refills'][$index - 1]['date']) }} days since last

@endif
@endforeach
@endforeach
@endsection