@extends('layouts.app')
@section('title', 'Budgets')
@section('content')
    <x-page-head title="Budgeting" subtitle="Budget variance & year-end forecast">
        <x-slot:actions>
            <a href="{{ route('finance.budgets.create') }}" class="btn btn-primary">New Budget</a>
        </x-slot:actions>
    </x-page-head>
    <x-panel>
        @if ($budgets->isEmpty())
            <x-empty-state title="No budgets" message="Create fiscal budgets and track variance against actuals." />
        @else
            <div class="table-wrap"><table><thead><tr><th>Name</th><th>Fiscal Year</th><th>Lines</th><th>Status</th><th></th></tr></thead><tbody>
                @foreach ($budgets as $budget)
                    <tr><td>{{ $budget->name }}</td><td>{{ $budget->fiscal_year }}</td><td>{{ $budget->lines->count() }}</td><td><x-badge variant="blue">{{ $budget->status }}</x-badge></td><td><a href="{{ route('finance.budgets.show', $budget) }}">View</a></td></tr>
                @endforeach
            </tbody></table></div>
            <div style="margin-top:16px;">{{ $budgets->links() }}</div>
        @endif
    </x-panel>
@endsection
