<?php
/**
 * Ship to multiple address template
 *
 * @see Mage_Checkout_Block_Multishipping_Addresses
 */
?>
<div class="multiple_addresses">
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<form id="checkout_multishipping_form" action="<?php echo $this->getPostActionUrl() ?>" method="post">
        <div class="page-title_multi">
            <h2><?php echo $this->__('Ship to Multiple Addresses') ?></h2>                                
        </div> <!--page-title_multi-->
        <div class="title-buttons">
       <button type="button" title="<?php echo $this->__('Enter a New Address') ?>" class="button new-address" onclick="$('add_new_address_flag').value=1; $('checkout_multishipping_form').submit();"><span><?php echo $this->__('Enter a New Address') ?></span></button>
    </div> <!--title-buttons-->
<div class="addresses">
    
    <fieldset class="multiple-checkout">
        <input type="hidden" name="continue" value="0" id="can_continue_flag" />
        <input type="hidden" name="new_address" value="0" id="add_new_address_flag" />
        <?php echo $this->__('Please select shipping address for applicable items') ?>
        <table class="data-table table-bordered" 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><?php echo $this->__('Remove') ?></th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <td colspan="100" class="a-right">                      
                      <button type="submit" title="<?php echo $this->__('Update Qty &amp; Addresses') ?>" class="button btn-update" 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): ?>
                <?php if ($_item->getQuoteItem()) :?>
                <tr>
                    <td><?php echo $this->getItemHtml($_item->getQuoteItem())?></td>
                    <td><input type="text" 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 class="btn-remove btn-remove2" href="<?php echo $this->getItemDeleteUrl($_item) ?>" title="<?php echo $this->__('Remove Item') ?>" ></a></td>                    
                </tr>
                <?php endif; ?>
            <?php endforeach; ?>
            </tbody>
        </table>
        
        </form>
<!-- Responsive Table -->
<form id="checkout_multishipping_form" action="<?php echo $this->getPostActionUrl() ?>" method="post">
        <table class="data-table table-bordered hidden-desktop" 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 class="hidden-table"><?php echo $this->__('Send To') ?></th>
                    <th><?php echo $this->__('Remove') ?></th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <td colspan="100" class="a-right">                      
                      <button type="submit" title="<?php echo $this->__('Update Qty &amp; Addresses') ?>" class="button btn-update" 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): ?>
                <?php if ($_item->getQuoteItem()) :?>
                <tr>
                    <td><?php echo $this->getItemHtml($_item->getQuoteItem())?></td>
                    <td><input type="text" 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 class="hidden-table"><?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 class="btn-remove btn-remove2" href="<?php echo $this->getItemDeleteUrl($_item) ?>" title="<?php echo $this->__('Remove Item') ?>" > </a></td>                    
                </tr>
                <?php endif; ?>
            <?php endforeach; ?>
            </tbody>
        </table>
        </form>
<!--End responsive table -->
        <script type="text/javascript">decorateTable('multiship-addresses-table')</script>
        <div class="buttons-set">         
            <a class="back-link" href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back to Shopping Cart') ?></a>   
            <button type="submit" title="<?php echo $this->__('Continue to Shipping Information') ?>" class="button btn-continue<?php if ($this->isContinueDisabled()):?> disabled<?php endif; ?>" onclick="$('can_continue_flag').value=1"<?php if ($this->isContinueDisabled()):?> disabled="disabled"<?php endif; ?>><span><?php echo $this->__('Continue to Shipping Information') ?></span></button>      
        </div>
    </fieldset> <!--multiple-checkout-->
</div> <!--addresses-->

</div> <!--multiple_addresses-->