@extends('layouts.employee') @section('page-title', 'Edit Expense') @section('page-subtitle', 'Edit expense — same sheet layout as Add') @section('content') @php // Normalize existing files into array of ['path'=>..., 'original_name'=>...] $existingFiles = []; if (isset($expense)) { if (!empty($expense->proof_paths) && is_array($expense->proof_paths)) { $existingFiles = $expense->proof_paths; } elseif (!empty($expense->proof_path)) { $existingFiles = [['path' => $expense->proof_path, 'original_name' => $expense->proof_original_name ?? basename($expense->proof_path)]]; } } @endphp {{-- TOP SECTION --}}

Edit Expense

Edit your expense using the same sheet layout as Add Expenses.

Expense Date: {{ $expense->expense_date->format('d M Y') }}

Notes
{{-- CARD --}}
{{-- header --}}

Expense Entry

Update the row below and save.

{{-- in-card banner --}} {{-- FORM --}}
@csrf @method('PUT') {{-- remove_files[] inputs appended here by JS --}}
{{-- single prefilled row (mirrors create row structure) --}} {{-- DATE --}} {{-- GROUP --}} {{-- PARTY NAME --}} {{-- PURPOSE --}} {{-- AMOUNT --}} {{-- ATTACHED (existing + add new) --}} {{-- ACTIONS --}}
Date Group Party Name Purpose Amount (₹) Attached
Date
Group
Party Name
Purpose
Amount (₹)
Attached
@if(count($existingFiles)) {{ collect($existingFiles)->pluck('original_name')->join(', ') }} @else No files @endif
{{-- hidden new file input (for adding more) --}}
{{-- existing files are also shown below the input on small screens --}}
@foreach($existingFiles as $f)
{{ $f['original_name'] ?? basename($f['path']) }}
Download
@endforeach
Actions
{{-- Desktop existing files list (shown under table on md+) --}}
{{-- TOTAL BAR & ACTIONS --}}
Current amount:
₹ {{ number_format((float)old('amount', $expense->amount), 2) }}
Cancel
{{-- container for remove_files[] hidden inputs (added by JS when user removes existing files) --}}
{{-- Styles for responsive table and equal heights (matches Create) --}} @endsection