<?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@magentocommerce.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.magentocommerce.com for more information.
 *
 * @category   design_default
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.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
 */
?>
<form action="<?php echo $this->getPostActionUrl() ?>" method="post">
<div class="page-head button-level">
    <h3><?php echo $this->__('Ship to Multiple Addresses') ?></h3>
    <button class="form-button-alt" type="submit" onclick="$('add_new_address_flag').value=1">
        <span><?php echo $this->__('Enter a New Address') ?></span>
    </button>
</div>
<div class="multi-address-checkout-description"><?php echo $this->__('Please select shipping address for applicable items') ?></div>

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<fieldset>
    <input type="hidden" name="continue" value="0" id="can_continue_flag"/>
    <input type="hidden" name="new_address" value="0" id="add_new_address_flag" />
    <table cellspacing="0" id="multiship-addresses-table" class="data-table box-table">
        <col width="300" />
        <col width="30" />
        <col />
        <col width="30" />
        <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><?php echo $this->__('Remove') ?></th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <td colspan="100" class="a-right"><button class="form-button-alt" type="submit" onclick="$('can_continue_flag').value=0"><span><?php echo $this->__('Update Qty &amp; Addresses') ?></span></button></td>
            </tr>
        </tfoot>
        <tbody>
        <?php foreach ($this->getItems() as $_index => $_item): ?>
            <tr>
                <td class="attributes-col">
                    <?php echo $this->getItemHtml($_item->getQuoteItem())?>
                </td>
                <td class="a-center"><input name="ship[<?php echo $_index ?>][<?php echo $_item->getQuoteItemId() ?>][qty]" value="<?php echo $this->htmlEscape($_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) ?>"><img src="<?php echo $this->getSkinUrl('images/btn_trash.gif') ?>" width="16" height="16" alt="<?php echo $this->__('Remove Item') ?>" /></a></td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
    <script type="text/javascript">decorateTable('multiship-addresses-table')</script>
<div class="button-set">
    <a href="<?php echo $this->getBackUrl() ?>" class="left"><?php echo $this->__('&laquo; Back to Shopping Cart') ?></a>
    <button class="form-button" type="submit" onclick="$('can_continue_flag').value=1" <?php if ($this->isContinueDisabled()):?>disabled="disabled" style="border-color:#999; background-color:#ccc;"<?php endif ?>><span><?php echo $this->__('Continue to Shipping Information') ?></span></button>
</div>
</fieldset>
</form>
