<?php
/**
 * OpenMage
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available at https://opensource.org/license/afl-3-0-php
 *
 * @category    design
 * @package     rwd_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
 * @copyright   Copyright (c) 2021-2024 The OpenMage Contributors (https://www.openmage.org)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Ship to multiple address template
 *
 * @see Mage_Checkout_Block_Multishipping_Addresses
 * @var Mage_Checkout_Block_Multishipping_Addresses $this
 */
?>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<form id="checkout_multishipping_form" action="<?php echo $this->getPostActionUrl() ?>" method="post">
    <div class="multiple-checkout">
        <div class="page-title title-buttons">
            <h1><?php echo $this->__('Ship to Multiple Addresses') ?></h1>
            <button data-action="add-new-customer-address" type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Enter a New Address')) ?>" class="button" onclick="$('add_new_address_flag').value=1; $('checkout_multishipping_form').submit();"><span><span><?php echo $this->__('Enter a New Address') ?></span></span></button>
        </div>
        <input type="hidden" name="continue" value="0" id="can_continue_flag" />
        <input type="hidden" name="new_address" value="0" id="add_new_address_flag" />
        <h2><?php echo $this->__('Please select shipping address for applicable items') ?></h2>
        <table class="data-table linearize-table" id="multiship-addresses-table">
            <col />
            <col width="1" />
            <col width="1" />
            <col width="1" />
            <thead>
            <tr>
                <th><?php echo $this->__('Product') ?></th>
                <th class="a-center"><?php echo $this->__('Qty') ?></th>
                <th><?php echo $this->__('Send To') ?></th>
                <th>&nbsp;</th>
            </tr>
            </thead>
            <tfoot>
            <tr>
                <td colspan="100" class="a-right">
                    <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Update Qty &amp; Addresses')) ?>"
                            class="button" onclick="$('can_continue_flag').value=0"
                            data-multiship-item-update>
                        <span><span><?php echo $this->__('Update Qty &amp; Addresses') ?></span></span>
                    </button>
                </td>
            </tr>
            </tfoot>
            <tbody>
            <?php foreach ($this->getItems() as $_index => $_item): ?>
                <?php if ($_item->getQuoteItem()) :?>
                    <tr>
                        <td><?php echo $this->getItemHtml($_item->getQuoteItem())?></td>
                        <td><input type="text" data-multiship-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" name="ship[<?php echo $_index ?>][<?php echo $_item->getQuoteItemId() ?>][qty]" value="<?php echo $this->escapeHtml($_item->getQty()) ?>" size="2" class="input-text qty" /></td>
                        <td data-rwd-label="Send To"><?php if ($_item->getProduct()->getIsVirtual()): echo $this->__('Shipping selection is not applicable.'); else: echo $this->getAddressesHtmlSelect($_item, $_index); endif; ?></td>
                        <td class="a-center"><a href="<?php echo $this->getItemDeleteUrl($_item) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove Item')) ?>" class="btn-remove2"><?php echo $this->__('Remove Item') ?></a></td>
                    </tr>
                <?php endif ?>
            <?php endforeach ?>
            </tbody>
        </table>
        <script type="text/javascript">decorateTable('multiship-addresses-table')</script>
        <div class="buttons-set">
            <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back to Shopping Cart') ?></a></p>
            <button type="submit" data-action="checkout-continue-shipping" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Continue to Shipping Information')) ?>" class="button<?php if ($this->isContinueDisabled()):?> disabled<?php endif ?>" onclick="$('can_continue_flag').value=1"<?php if ($this->isContinueDisabled()):?> disabled="disabled"<?php endif ?>><span><span><?php echo $this->__('Continue to Shipping Information') ?></span></span></button>
        </div>
    </div>
    <?php echo $this->getBlockHtml('formkey') ?>
</form>
