@extends('layouts.app', ['pageTitle' => 'Budgets', 'pageSubtitle' => 'Create department or account-level budgets'])
@section('content')
<div class="card"><h3 class="section-title">Create Budget</h3><form method="POST" action="{{ route('admin.budgets.store') }}" class="form-grid">@csrf
<div class="field"><label>Department</label><input name="department"></div><div class="field"><label>Account</label><select name="chart_of_account_id"><option value="">None</option>@foreach($accounts as $a)<option value="{{ $a->id }}">{{ $a->code }} - {{ $a->name }}</option>@endforeach</select></div><div class="field"><label>Period Start</label><input type="date" name="period_start" required></div><div class="field"><label>Period End</label><input type="date" name="period_end" required></div><div class="field"><label>Allocated Amount</label><input type="number" step="0.01" name="allocated_amount" required></div><div class="field"><label>Notes</label><input name="notes"></div><div><button class="btn" type="submit">Save Budget</button></div></form></div>
<div class="card"><h3 class="section-title">Budgets</h3><div class="table-wrap"><table><thead><tr><th>No</th><th>Department</th><th>Account</th><th>Period</th><th>Allocated</th><th>Spent</th><th>Status</th></tr></thead><tbody>@foreach($budgets as $b)<tr><td>{{ $b->budget_number }}</td><td>{{ $b->department }}</td><td>{{ $b->account_name }}</td><td>{{ $b->period_start }} - {{ $b->period_end }}</td><td>₦{{ number_format($b->allocated_amount,2) }}</td><td>₦{{ number_format($b->spent_amount,2) }}</td><td>{{ $b->status }}</td></tr>@endforeach</tbody></table></div></div>
@endsection
