<?php
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
?>
<script type="text/javascript">
    //<![CDATA[
    Jsw.onReady(function () {
        document.getElementById('outgoingMailMessagesDate').value = '<?php echo $this->date;?>';
    });
    //]]>
</script>

<tr><td colspan="3"><p><?php echo $this->lmsg('attemptsDescription'); ?></p></td></tr>
<?php foreach($this->messagesList as $hour => $messagesInHour): ?>
    <tr>
        <td>
            <?php echo $hour . ":00";?>
        </td>
        <?php if (empty($messagesInHour)): ?>
            <?php if (!($this->today && $hour == $this->lastHour)): ?>
                <td align="right">0</td>
                <td class="bar-chart-table-data">
                <span class="bar-chart-item">
                    <i style="width: 0%"></i>
                </span>
                </td>
            <?php else: ?>
                <td align="right">0</td>
                <td class="bar-chart-table-data">
                <span class="bar-chart-item <?php if ($this->highlightLastHour): ?> bar-chart-item-over<?php endif;?>">
                    <i style="width: 0%"></i>
                    <b><?php echo ($this->highlightLastHour) ? $this->lmsg('notSendingNow') : $this->lmsg('calculatingNow'); ?>
                </span>
                </td>
            <?php endif;?>
        <?php else: ?>
            <td align="right"><?php echo $messagesInHour->passed + $messagesInHour->rejected; ?></td>
            <td class="bar-chart-table-data">
                <span class="bar-chart-item <?php if (0 < $messagesInHour->rejected): ?> bar-chart-item-over<?php endif;?>">
                    <i style="width: <?php
                            $percent = (0 < $messagesInHour->rejected || 0 == $messagesInHour->limitValue) ? 100
                                : 100 * ($messagesInHour->passed / $messagesInHour->limitValue);
                            echo "{$percent}%";
                        ?>"></i>
                        <?php if (0 < $messagesInHour->rejected): ?>
                            <b>
                                <?php echo $messagesInHour->passed; ?> <?php echo $this->lmsg('passed'); ?> /
                                <?php echo $messagesInHour->rejected; ?> <?php echo $this->lmsg('rejected'); ?>
                            </b>
                        <?php endif;?>

                </span>
            </td>
        <?php endif; ?>
    </tr>
<?php endforeach; ?>
