<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<div class="container-fluid">
    <div class="wrapper">
        <div class="content"></div>
        <h1>Expense Management</h1>
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>Expense ID</th>
                    <th>Description</th>
                    <th>Amount</th>
                    <th>Date</th>
                    <th>Status</th>
                </tr>
            </thead>
            <tbody>
                <?php
                // Example data - in a real scenario, this will be fetched from the database
                $expenses = [
                    ['expense_id' => 'E001', 'description' => 'Purchase of textbooks', 'amount' => '$500', 'date' => '2024-07-01', 'status' => 'Approved'],
                    ['expense_id' => 'E002', 'description' => 'Lab equipment maintenance', 'amount' => '$300', 'date' => '2024-07-02', 'status' => 'Pending'],
                    ['expense_id' => 'E003', 'description' => 'Sports equipment', 'amount' => '$700', 'date' => '2024-07-03', 'status' => 'Approved'],
                    // Add more records as needed
                ];

                foreach ($expenses as $expense) {
                    $dateDisp = !empty($expense['date']) ? local_date($expense['date'], 'm-d-Y') : '';
                    echo "<tr>
                        <td>{$expense['expense_id']}</td>
                        <td>{$expense['description']}</td>
                        <td>{$expense['amount']}</td>
                        <td>" . esc($dateDisp) . "</td>
                        <td>{$expense['status']}</td>
                    </tr>";
                }
                ?>
            </tbody>
        </table>
    </div>
</div>
<?= $this->endSection() ?>
