@extends('layouts.app')
@section('title','Add Business Capital')
@section('content')
<x-ui.form-shell title="Add Business Capital" description="Record owner/business funds entering a financial account. Capital increases available funds but is not treated as income." :breadcrumbs="[['label'=>'Dashboard','url'=>route('dashboard')],['label'=>'Financial Accounts','url'=>route('accounts.index')],['label'=>'Add Capital']]" narrow>
<form method="POST" action="{{ route('capital-injections.store') }}" class="mf-form">@csrf
<x-ui.form-section title="Capital Entry" description="This posting creates an account transaction and balanced Asset/Capital accounting entries."><x-ui.form-grid>
<div class="mf-col-6"><label class="mf-field-label">Receiving account</label><select class="mf-input" name="account_id" required><option value="">Select account</option>@foreach($accounts as $account)<option value="{{ $account->id }}" @selected((int)old('account_id',request('account'))===$account->id)>{{ $account->name }} · {{ $account->branch->name }} · {{ number_format((float)$account->current_balance,2) }}</option>@endforeach</select>@error('account_id')<p class="mf-field-error">{{ $message }}</p>@enderror</div>
<div class="mf-col-3"><label class="mf-field-label">Amount</label><input type="number" min="0.01" step="0.01" class="mf-input" name="amount" value="{{ old('amount') }}" required>@error('amount')<p class="mf-field-error">{{ $message }}</p>@enderror</div>
<div class="mf-col-3"><label class="mf-field-label">Date</label><input type="date" class="mf-input" name="date" value="{{ old('date',now()->format('Y-m-d')) }}" required></div>
<div class="mf-col-4"><label class="mf-field-label">Reference</label><input class="mf-input" name="reference" value="{{ old('reference') }}" placeholder="Optional receipt/bank reference"></div>
<div class="mf-col-8"><label class="mf-field-label">Notes</label><input class="mf-input" name="notes" value="{{ old('notes') }}" placeholder="Reason/source of capital"></div>
</x-ui.form-grid></x-ui.form-section>
<x-ui.form-actions><a class="mf-btn" href="{{ route('accounts.index') }}">Cancel</a><button class="mf-btn mf-btn-primary">Post Capital</button></x-ui.form-actions>
</form></x-ui.form-shell>
@endsection
