<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * 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 through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license     http://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
 */
?>
<?php echo $this->getMessagesBlock()->toHtml() ?>
<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" 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"
                          data-multiship-item-update
                          title="<?php echo Mage::helper('core')->quoteEscape($this->__('Update Qty &amp; Addresses')) ?>"
                          class="button" onclick="$('can_continue_flag').value=0">
                            <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><?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>
</form>
