<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<div class="container-fluid">
    <div class="wrapper">
        <div class="content"></div>
                <h1>Budget Reports</h1>
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>Report ID</th>
                            <th>Period</th>
                            <th>Total Income</th>
                            <th>Total Expenses</th>
                            <th>Net Balance</th>
                            <th>Date Generated</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        // Example data - in a real scenario, this will be fetched from the database
                        $budgetReports = [
                            ['report_id' => 'BR001', 'period' => 'Q1 2024', 'total_income' => '$5000', 'total_expenses' => '$3000', 'net_balance' => '$2000', 'date_generated' => '2024-07-01'],
                            ['report_id' => 'BR002', 'period' => 'Q2 2024', 'total_income' => '$7000', 'total_expenses' => '$4000', 'net_balance' => '$3000', 'date_generated' => '2024-07-02'],
                            ['report_id' => 'BR003', 'period' => 'Q3 2024', 'total_income' => '$8000', 'total_expenses' => '$5000', 'net_balance' => '$3000', 'date_generated' => '2024-07-03'],
                            // Add more records as needed
                        ];

                        foreach ($budgetReports as $report) {
                            $dateDisp = !empty($report['date_generated']) ? local_date($report['date_generated'], 'm-d-Y') : '';
                            echo "<tr>
                                    <td>{$report['report_id']}</td>
                                    <td>{$report['period']}</td>
                                    <td>{$report['total_income']}</td>
                                    <td>{$report['total_expenses']}</td>
                                    <td>{$report['net_balance']}</td>
                                    <td>" . esc($dateDisp) . "</td>
                                  </tr>";
                        }
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
       <?= $this->endSection() ?>
