<?php

use Mtc\Core\Models\CountryState;

?>
<table width="100%" cellpadding="5">
    <?php
    if (!empty($basket->address['shipping']['firstname']) && !empty($basket->address['shipping']['lastname'])) {
    ?>
        <tr>
            <td class="basket_item" width="130">Name</td>
            <td><?= clean_page($basket->address['shipping']['firstname']) ?> <?= clean_page($basket->address['shipping']['lastname']) ?></td>
        </tr>
    <?php
    }
    ?>

    <?php
    if (!empty($basket->address['shipping']['address1'])) {
    ?>
        <tr>
            <td class="basket_item">Address1</td>
            <td><?= clean_page($basket->address['shipping']['address1']) ?></td>
        </tr>
    <?php
    }

    if (!empty($basket->address['shipping']['address2'])) {
    ?>
    <tr>
        <td class="basket_item">Address2</td>
        <td><?= clean_page($basket->address['shipping']['address2']) ?></td>
    </tr>
    <?php
    }

    if (!empty($basket->address['shipping']['city'])) {
    ?>
        <tr>
            <td class="basket_item">City</td>
            <td><?= clean_page($basket->address['shipping']['city']) ?></td>
        </tr>
    <?php
    }

    if (!empty($basket->address['shipping']['country']) && !empty($basket->address['shipping']['state'])) {
    ?>
        <tr>
            <td class="basket_item">State</td>
            <td><?= clean_page(CountryState::getNameByCode($basket->address['shipping']['country'], $basket->address['shipping']['state'])) ?></td>
        </tr>
    <?php
    }

    if (!empty($basket->address['shipping']['country'])) {
    ?>
        <tr>
            <td class="basket_item">Country</td>
            <td><?= clean_page($basket->address['shipping']['country']) ?></td>
        </tr>
    <?php
    }

    if (!empty($basket->address['shipping']['postcode'])) {
    ?>
        <tr>
            <td class="basket_item">Postcode</td>
            <td><?= clean_page($basket->address['shipping']['postcode']) ?></td>
        </tr>
    <?php
    }
    ?>
</table>
