<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<div class="container-fluid">
    <div class="wrapper">
        <div class="content"></div>
                <h1>Communication Logs</h1>
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>Date</th>
                            <th>Sender</th>
                            <th>Recipient</th>
                            <th>Message</th>
                            <th>Status</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        // Example data - in a real scenario, this will be fetched from the database
                        $communicationLogs = [
                            ['date' => '2024-07-01', 'sender' => 'Teacher A', 'recipient' => 'Parent B', 'message' => 'Discussed student performance.', 'status' => 'Sent'],
                            ['date' => '2024-07-02', 'sender' => 'Teacher C', 'recipient' => 'Parent D', 'message' => 'Meeting request.', 'status' => 'Received'],
                            ['date' => '2024-07-03', 'sender' => 'administrator', 'recipient' => 'Teacher A', 'message' => 'Policy update.', 'status' => 'Sent'],
                            // Add more logs as needed
                        ];

                        foreach ($communicationLogs as $log) {
                            $dateDisp = !empty($log['date']) ? local_date($log['date'], 'm-d-Y') : '';
                            echo "<tr>
                                    <td>" . esc($dateDisp) . "</td>
                                    <td>{$log['sender']}</td>
                                    <td>{$log['recipient']}</td>
                                    <td>{$log['message']}</td>
                                    <td>{$log['status']}</td>
                                  </tr>";
                        }
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<?= $this->endSection() ?>
