<?php
/** @var $block Dotdigitalgroup\Email\Block\Adminhtml\Email\Items */
?>
<?php if ($block->hasItems()) { ?>
    <p><strong>Automation errors</strong></p>

    <table class="notification-items"
           summary="<?= $block->escapeHtmlAttr(__('System Alert Notifications - Automation Errors')) ?>"
           style="border-collapse: collapse; border: 1px solid black;">
        <thead>
        <tr>
            <th style="padding: 10px; border: 1px solid black;"><?= $block->escapeHtml(__('Id')) ?></th>
            <th style="padding: 10px; border: 1px solid black;"><?= $block->escapeHtml(__('Automation Type')) ?></th>
            <th style="padding: 10px; border: 1px solid black;"><?= $block->escapeHtml(__('Enrolment Status')) ?></th>
            <th style="padding: 10px; border: 1px solid black;"><?= $block->escapeHtml(__('Message')) ?></th>
            <th style="padding: 10px; border: 1px solid black;"><?= $block->escapeHtml(__('Created at')) ?></th>
        </tr>
        </thead>
        <tbody>
        <?php foreach ($block->getItems() as $item): ?>
            <tr>
                <td style="padding: 10px; border: 1px solid black;">
                    <?= $block->escapeHtml($item['id']) ?>
                </td>
                <td style="padding: 10px; border: 1px solid black;">
                    <?= $block->escapeHtml($item['automation_type']) ?>
                </td>
                <td style="padding: 10px; border: 1px solid black;">
                    <?= $block->escapeHtml($item['enrolment_status']) ?>
                </td>
                <td style="padding: 10px; border: 1px solid black;">
                    <?= $block->escapeHtml($item['message']) ?>
                </td>
                <td style="padding: 10px; border: 1px solid black;">
                    <?= $block->escapeHtml($item['created_at']) ?>
                </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>

    <p>
        <?= $block->escapeHtml(
            __(
                'Note that automations with pending status older than 1 hour will be flagged here.
                Please go to the Automation Enrolment Tasks report to review.'
            )
        ); ?>
    </p>
<?php } ?>
