@extends('admin.layout.app') @section('body')
{{-- Flash alerts --}} @if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif {{-- Validation summary --}} @if ($errors->any())
There were some problems with your input:
@endif

Edit Fuel Expense

Update fuel spend, meter, and attachments
Back
@csrf @method('PUT')
{{-- Machinery --}}
@error('machinery_id')
{{ $message }}
@enderror
{{-- Date --}}
@error('spent_at')
{{ $message }}
@enderror
{{-- Vendor --}}
@error('vendor')
{{ $message }}
@enderror
{{-- Liters --}}
@error('quantity_liters')
{{ $message }}
@enderror
{{-- Unit Price --}}
@error('unit_price')
{{ $message }}
@enderror
{{-- Amount (auto calc, read-only) --}}
@php $autoAmount = (float) old('quantity_liters', $expense->quantity_liters) * (float) old('unit_price', $expense->unit_price); @endphp
{{-- Meter Reading --}}
@error('meter_reading')
{{ $message }}
@enderror
{{-- Notes --}}
@error('notes')
{{ $message }}
@enderror
{{-- Existing Attachments --}}
@php $existing = is_array($expense->attachments) ? $expense->attachments : (json_decode($expense->attachments ?? '[]', true) ?: []); @endphp @if (empty($existing))

No files.

@else
@foreach ($existing 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) @elseif($isPdf) @else @endif
@endforeach
@endif
{{-- Add more attachments --}}
@error('attachments.*')
{{ $message }}
@enderror
Cancel
{{-- quick auto-calc --}} @endsection