@extends('layouts.app') @section('page_title',$expense->exists?'Edit Expense':'New Expense') @section('content')<form method="POST" action="{{ $expense->exists ? route('expenses.update',$expense) : route('expenses.store') }}">@csrf @if($expense->exists) @method('PUT') @endif <div class="card top-card"><div class="card-body"><div class="row g-3"><div class="col-md-4"><label>Date</label><input type="date" name="expense_date" value="{{ old('expense_date',$expense->expense_date ?? date('Y-m-d')) }}" class="form-control" required></div><div class="col-md-4"><label>Category</label><select name="expense_category_id" class="form-select">@foreach($categories as $cat)<option value="{{ $cat->id }}" @selected(old('expense_category_id',$expense->expense_category_id)==$cat->id)>{{ $cat->name_en }}</option>@endforeach</select></div><div class="col-md-4"><label>Currency</label><select name="currency_id" class="form-select">@foreach($currencies as $c)<option value="{{ $c->id }}" @selected(old('currency_id',$expense->currency_id)==$c->id)>{{ $c->code }}</option>@endforeach</select></div><input type="hidden" name="exchange_rate" value="1"><div class="col-md-6"><label>Amount</label><input type="number" step="0.01" name="amount" value="{{ old('amount',$expense->amount) }}" class="form-control" required></div><div class="col-12"><label>Notes</label><textarea name="notes" class="form-control">{{ old('notes',$expense->notes) }}</textarea></div><div class="col-12 text-end"><button class="btn btn-success">Save</button></div></div></div></div></form>@endsection
