@extends('admin.layout.app') @section('body') @php // Try to read company name from relations; fallback to app.name $companyName = optional(optional($expense->machinery)->company)->name ?? config('app.name', 'Your Company'); @endphp

Fuel Expense #{{ $expense->id }}

Edit Back
{{-- PRINT AREA START --}}
{{-- Print Header (visible only when printing) --}}
Date
{{ optional($expense->spent_at)->format('Y-m-d') }}
Machinery
{{ optional($expense->machinery)->name ?? '#' . $expense->machinery_id }}
Liters
{{ number_format($expense->quantity_liters, 2) }}
Unit Price
{{ number_format($expense->unit_price, 2) }}
Total
{{ number_format($expense->total_amount, 2) }}
Vendor
{{ $expense->vendor ?? '—' }}
Meter Reading
{{ $expense->meter_reading ?? '—' }}
Notes
{{ $expense->notes ?? '—' }}
Attachments
@php $files = is_array($expense->attachments) ? $expense->attachments : (json_decode($expense->attachments ?? '[]', true) ?: []); @endphp @if (empty($files)) No files. @else
@foreach ($files as $path) @php $url = asset('storage/' . $path); $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); $isImg = in_array($ext, ['png', 'jpg', 'jpeg', 'gif', 'webp']); $isPdf = $ext === 'pdf'; @endphp
@if ($isImg) img @elseif($isPdf) @else @endif
@endforeach
@endif
{{-- Print Footer (visible only when printing) --}}
{{-- PRINT AREA END --}}
{{-- Print only the content area --}} {{-- Screen-only styles for header/footer visibility control --}} @endsection