<?php
/**
 * @version 7.3
 */

if (!empty($errors)) { ?>
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        <?php echo $errors; ?>
    </div>
<?php
}
else {
    ?>
    <table class="table">
        <thead>
        <tr>
            <?php if ($enableSelection) { ?>
                <th class="size-tiny"></th>
            <?php } ?>
            <th class="size-mini"><?php echo $this->_('Price'); ?></th>
            <?php if ($postageType === \Ppb\Model\Shipping::POSTAGE_TYPE_CARRIERS) { ?>
                <th class="size-mini"><?php echo $this->_('Carrier'); ?></th>
            <?php } ?>
            <th><?php echo $this->_('Shipping Method / Service'); ?></th>
        </tr>
        </thead>
        <tbody>
        <?php foreach ($postage as $key => $row) { ?>
            <tr>
                <?php if ($enableSelection) { ?>
                    <td>
                        <input type="radio" name="postage_id" value="<?php echo $key; ?>"
                               onchange="this.form.submit();" <?php echo ((string)$key === $postageId) ? 'checked' : ''; ?>>
                    </td>
                <?php } ?>
                <td><?php echo $this->amount($row['price'], $row['currency']); ?></td>
                <?php if ($postageType === \Ppb\Model\Shipping::POSTAGE_TYPE_CARRIERS) { ?>
                    <td><?php echo $this->_($row['carrier']); ?></td>
                <?php } ?>
                <td><?php echo $this->_($row['method']); ?></td>
            </tr>
        <?php } ?>

        <?php if ($postageSettings[\Ppb\Model\Shipping::SETUP_FREE_POSTAGE]) { ?>
            <tr>
                <td colspan="3">
                    <?php echo sprintf(
                        $this->_('* Free postage on orders over %s'),
                        $this->amount($postageSettings[\Ppb\Model\Shipping::SETUP_FREE_POSTAGE_AMOUNT])); ?></td>
            </tr>
        <?php } ?>
        </tbody>
    </table>
<?php } ?>

