<h1 class="title"><?= __('Messages') ?></h1>

<ul class="breadcrumber">
    <li><a href="<?= url_to('/') ?>" data-ajax><?= __('Home') ?></a></li>
    <li class="active"><?= __('Messages') ?></li>
</ul>

<div class="box-panel">
    <div class="box-panel-title"><?= __('My messages') ?></div>

    <div class="box-panel-content">
        <table class="list">
            <thead>
                <tr>
                    <th><?= __('Title') ?></th>
                    <th width="70"><?= __('Created at') ?></th>
                </tr>
            </thead>

            <tbody>
                <?php if (empty($messages)): ?>
                    <tr>
                        <td colspan="2"><?= __('No messages found') ?></td>
                    </tr>
                <?php else: ?>
                    <?php foreach ($messages as $message): ?>
                        <tr>
                            <td>
                                <a style="<?= $message['visualized'] ?: 'font-weight:bold' ?>" data-ajax href="<?= url_to('/message/' . $message['id']) ?>"><?= $message['title'] ?></a>
                            </td>
                            <td><?= util('Date')->date($message['create_date']) ?></td>
                        </tr>
                    <?php endforeach ?>
                <?php endif ?>
            </tbody>
        </table>
    </div>
</div>